Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2011-10-25 12:23:50 +0000
committercletavernie2011-10-25 12:23:50 +0000
commitd53a354863ddf38b8dc32e8c2bd8093d28181c5c (patch)
tree5d6ac5d3fd3c68a8ec2e19243e7885c9722c931d /plugins/uml/org.eclipse.papyrus.diagram.statemachine
parenteba71cd1d3fffbeedcf0aff9d81e1367dd5e3423 (diff)
downloadorg.eclipse.papyrus-d53a354863ddf38b8dc32e8c2bd8093d28181c5c.tar.gz
org.eclipse.papyrus-d53a354863ddf38b8dc32e8c2bd8093d28181c5c.tar.xz
org.eclipse.papyrus-d53a354863ddf38b8dc32e8c2bd8093d28181c5c.zip
359057: [Architecture - SVN - Build] The Papyrus architecture should be refactored
https://bugs.eclipse.org/bugs/show_bug.cgi?id=359057
Diffstat (limited to 'plugins/uml/org.eclipse.papyrus.diagram.statemachine')
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/.classpath8
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/.options7
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/.project28
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/.svnignore1
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/META-INF/MANIFEST.MF70
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/about.html28
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/build.properties8
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/CreateStateMachineDiagramCommand.java182
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/CreateStateMachineDiagramWithNavigationHandler.java25
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/StateMachineDiagramCreationCondition.java34
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/StateMachineDiagramEditorFactory.java34
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/StateMachineDiagramModelListener.java13
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/UmlStateMachineDiagramForMultiEditor.java144
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CreateViewCommand.java32
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomCompositeStateSetBoundsCommand.java157
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomCompositeStateWithDefaultRegionCreateNodeCommand.java84
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomConnectionPointReferenceCreateCommand.java22
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomFirstRegionInCompositeStateCreateElementCommand.java180
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomPseudostateEntryPointCreateCommand.java43
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomPseudostateExitPointCreateCommand.java43
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomRegionCreateElementCommand.java198
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomRegionDeleteCommand.java113
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomRegionDestroyElementCommand.java46
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomRegionMoveCommand.java215
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomRegionResizeCommand.java193
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomStateMachineResizeCommand.java346
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomStateMachineSetBoundsCommand.java123
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomStateMachineWithDefaultRegionCreateNodeCommand.java84
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomStateResizeCommand.java352
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomVertexCreateElementCommand.java147
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomConnectionPointReferenceNameEditPart.java74
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomFinalStateEditPart.java24
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomPackageEditPart.java23
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomRegionCompartmentEditPart.java70
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomRegionEditPart.java96
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateCompartmentEditPart.java51
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateEditPart.java22
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateMachineCompartmentEditPart.java51
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateMachineEditPart.java23
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateMachineNameEditPart.java98
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateNameEditPart.java164
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomTransitionGuardEditPart.java115
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/expressions/UMLAbstractExpression.java164
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/factory/CustomUMLEditPartFactory.java70
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/ConnectionPointReferenceFigure.java129
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/CustomShapeCompartmentFigure.java26
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/FinalStateFigure.java85
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateChoiceFigure.java102
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateDeepHistoryFigure.java89
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateEntryPointFigure.java79
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateExitPointFigure.java87
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateInitialFigure.java87
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateJoinForkFigure.java74
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateJunctionFigure.java78
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateShallowHistoryFigure.java84
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateTerminateFigure.java94
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/RegionFigure.java111
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/RoundedBorder.java47
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/RoundedShadowBorder.java96
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/StateFigure.java244
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/StateMachineFigure.java121
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/TransitionFigure.java39
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/helpers/StateMachineLinkMappingHelper.java49
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/helpers/Zone.java1020
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/listeners/DropTargetListener.java81
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/locators/CustomEntryExitPointPositionLocator.java194
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/parsers/TransitionPropertiesParser.java124
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/parts/RegionCompartmentDiagramUpdater.java95
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomPackageCreationEditPolicy.java40
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomPackageXYLayoutEditPolicy.java123
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomPseudostateForkJoinResizeEditPolicy.java54
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomRegionCompartmentCreationEditPolicy.java185
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomRegionCompartmentXYLayoutEditPolicy.java109
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomRegionComponentEditPolicy.java69
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomRegionDragTracker.java114
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomRegionItemSemanticEditPolicy.java73
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomRegionResizableEditPolicy.java167
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateCompartmentCreationEditPolicy.java193
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateCompartmentXYLayoutEditPolicy.java94
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateCreationEditPolicy.java217
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateItemSemanticEditPolicy.java27
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateLayoutEditPolicy.java113
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateMachineCompartmentXYLayoutEditPolicy.java94
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateMachineDiagramDragDropEditPolicy.java791
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateMachineLayoutEditPolicy.java105
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/RemoveOrphanViewPolicy.java48
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/preferences/CustomStatePreferencePage.java21
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/providers/CustomUMLEditPartProvider.java13
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/icons/UMLDiagramFile.gifbin339 -> 0 bytes
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/icons/obj16/Diagram_StateMachine.gifbin111 -> 0 bytes
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/icons/wizban/NewUMLWizard.gifbin2466 -> 0 bytes
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/messages.properties90
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/model/stateMachineDiagram.gmfgen2169
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/plugin.properties43
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/plugin.xml1080
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/ConnectionPointReferenceCreateCommand.java116
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/FinalStateCreateCommand.java116
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/GeneralizationCreateCommand.java117
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/GeneralizationReorientCommand.java152
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateChoiceCreateCommand.java116
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateDeepHistoryCreateCommand.java116
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateEntryPointCreateCommand.java116
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateExitPointCreateCommand.java116
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateForkCreateCommand.java116
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateInitialCreateCommand.java116
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateJoinCreateCommand.java116
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateJunctionCreateCommand.java116
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateShallowHistoryCreateCommand.java116
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateTerminateCreateCommand.java116
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/RegionCreateCommand.java116
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/StateCreateCommand.java116
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/StateMachineCreateCommand.java116
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/TransitionCreateCommand.java155
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/TransitionReorientCommand.java157
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/UMLReorientConnectionViewCommand.java67
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/ConnectionPointReferenceEditHelper.java7
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/FinalStateEditHelper.java7
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/GeneralizationEditHelper.java7
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/PackageEditHelper.java7
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/PseudostateEditHelper.java8
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/RegionEditHelper.java7
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/StateEditHelper.java7
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/StateMachineEditHelper.java7
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/TransitionEditHelper.java8
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/UMLBaseEditHelper.java96
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/ConnectionPointReferenceEditPart.java406
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/ConnectionPointReferenceNameEditPart.java746
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/ConnectionPointReferenceStereotypeEditPart.java750
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/FinalStateEditPart.java396
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/FinalStateNameEditPart.java747
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/FinalStateStereotypeEditPart.java751
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/GeneralizationEditPart.java101
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/GeneralizationStereotypeEditPart.java710
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PackageEditPart.java190
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateChoiceEditPart.java399
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateChoiceNameEditPart.java746
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateChoiceStereotypeEditPart.java750
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateDeepHistoryEditPart.java399
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateDeepHistoryNameEditPart.java746
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateDeepHistoryStereotypeEditPart.java750
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateEntryPointEditPart.java403
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateEntryPointNameEditPart.java746
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateEntryPointStereotypeEditPart.java750
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateExitPointEditPart.java406
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateExitPointNameEditPart.java746
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateExitPointStereotypeEditPart.java750
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateForkEditPart.java401
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateForkNameEditPart.java746
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateForkStereotypeEditPart.java750
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateInitialEditPart.java399
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateInitialNameEditPart.java746
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateInitialStereotypeEditPart.java750
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateJoinEditPart.java401
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateJoinNameEditPart.java746
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateJoinStereotypeEditPart.java750
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateJunctionEditPart.java399
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateJunctionNameEditPart.java746
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateJunctionStereotypeEditPart.java750
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateShallowHistoryEditPart.java399
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateShallowHistoryNameEditPart.java746
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateShallowHistoryStereotypeEditPart.java750
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateTerminateEditPart.java399
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateTerminateNameEditPart.java746
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateTerminateStereotypeEditPart.java750
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/RegionCompartmentEditPart.java122
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/RegionEditPart.java304
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/StateCompartmentEditPart.java122
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/StateEditPart.java507
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/StateMachineCompartmentEditPart.java120
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/StateMachineEditPart.java429
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/StateMachineNameEditPart.java745
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/StateNameEditPart.java761
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/TransitionEditPart.java105
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/TransitionGuardEditPart.java727
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/TransitionNameEditPart.java727
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/TransitionStereotypeEditPart.java710
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/UMLEditPartFactory.java338
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/ConnectionPointReferenceItemSemanticEditPolicy.java98
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/FinalStateItemSemanticEditPolicy.java98
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/GeneralizationItemSemanticEditPolicy.java40
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PackageCanonicalEditPolicy.java469
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PackageItemSemanticEditPolicy.java63
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateChoiceItemSemanticEditPolicy.java98
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateDeepHistoryItemSemanticEditPolicy.java98
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateEntryPointItemSemanticEditPolicy.java98
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateExitPointItemSemanticEditPolicy.java98
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateForkItemSemanticEditPolicy.java98
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateInitialItemSemanticEditPolicy.java98
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateJoinItemSemanticEditPolicy.java98
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateJunctionItemSemanticEditPolicy.java98
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateShallowHistoryItemSemanticEditPolicy.java98
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateTerminateItemSemanticEditPolicy.java98
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/RegionCompartmentCanonicalEditPolicy.java241
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/RegionCompartmentItemSemanticEditPolicy.java74
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/RegionItemSemanticEditPolicy.java415
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateCanonicalEditPolicy.java225
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateCompartmentCanonicalEditPolicy.java172
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateCompartmentItemSemanticEditPolicy.java34
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateItemSemanticEditPolicy.java273
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateMachineCanonicalEditPolicy.java203
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateMachineCompartmentCanonicalEditPolicy.java217
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateMachineCompartmentItemSemanticEditPolicy.java38
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateMachineItemSemanticEditPolicy.java259
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/TransitionItemSemanticEditPolicy.java40
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/UMLBaseItemSemanticEditPolicy.java352
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/UMLTextNonResizableEditPolicy.java223
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/UMLTextSelectionEditPolicy.java207
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLAbstractNavigatorItem.java58
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLDomainNavigatorContentProvider.java217
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLDomainNavigatorItem.java106
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLDomainNavigatorLabelProvider.java94
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorActionProvider.java168
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorContentProvider.java382
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorGroup.java97
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorItem.java84
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorLabelProvider.java230
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorLinkHelper.java115
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorSorter.java27
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/parsers/AbstractParser.java418
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/parsers/MessageFormatParser.java189
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/DeleteElementAction.java3
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/DiagramEditorContextMenuProvider.java49
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/LoadResourceAction.java30
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/Messages.java459
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/ModelElementSelectionPage.java143
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLCreationWizard.java154
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLCreationWizardPage.java83
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDiagramActionBarContributor.java47
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDiagramEditor.java521
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDiagramEditorPlugin.java301
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDiagramEditorUtil.java366
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDiagramUpdateCommand.java78
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDiagramUpdater.java964
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDocumentProvider.java976
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLInitDiagramFileAction.java86
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLLinkDescriptor.java92
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLMatchingStrategy.java34
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLNewDiagramFileWizard.java161
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLNodeDescriptor.java42
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLPaletteFactory.java328
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLUriEditorInputTester.java22
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLVisualIDRegistry.java807
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/ValidateAction.java251
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/ConnectionPointReferencePreferencePage.java51
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/DiagramAppearancePreferencePage.java18
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/DiagramConnectionsPreferencePage.java18
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/DiagramGeneralPreferencePage.java20
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/DiagramPreferenceInitializer.java42
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/DiagramPrintingPreferencePage.java18
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/DiagramRulersAndGridPreferencePage.java18
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/FinalStatePreferencePage.java51
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/GeneralizationPreferencePage.java36
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/PseudostatePreferencePage.java51
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/RegionPreferencePage.java71
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/StateMachinePreferencePage.java71
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/StatePreferencePage.java71
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/TransitionPreferencePage.java36
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/ElementInitializers.java971
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLEditPartProvider.java141
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLElementTypes.java380
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLIconProvider.java31
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLMarkerNavigationProvider.java81
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLModelingAssistantProvider.java420
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLParserProvider.java678
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLValidationDecoratorProvider.java59
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLValidationProvider.java66
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLViewProvider.java993
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/sheet/UMLPropertySection.java110
-rw-r--r--plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/sheet/UMLSheetLabelProvider.java78
270 files changed, 0 insertions, 62786 deletions
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/.classpath b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/.classpath
deleted file mode 100644
index d6629866f98..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/.classpath
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src/"/>
- <classpathentry kind="src" path="custom-src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/.options b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/.options
deleted file mode 100644
index 3e7bace4006..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/.options
+++ /dev/null
@@ -1,7 +0,0 @@
-# Tracing options for the org.eclipse.papyrus.diagram.statemachine plug-in
-
-# Common issues
-org.eclipse.papyrus.diagram.statemachine/debug=false
-
-# Visual IDs
-org.eclipse.papyrus.diagram.statemachine/debug/visualID=false
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/.project b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/.project
deleted file mode 100644
index b1e09a846fe..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.papyrus.diagram.statemachine</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/.settings/org.eclipse.core.resources.prefs b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 27c6d84fea1..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Thu Jun 30 11:29:35 CEST 2011
-eclipse.preferences.version=1
-encoding/<project>=UTF-8
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/.svnignore b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/.svnignore
deleted file mode 100644
index c5e82d74585..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/.svnignore
+++ /dev/null
@@ -1 +0,0 @@
-bin \ No newline at end of file
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/META-INF/MANIFEST.MF b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/META-INF/MANIFEST.MF
deleted file mode 100644
index 413ab73fa76..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,70 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.papyrus.diagram.statemachine; singleton:=true
-Bundle-Version: 0.9.0.qualifier
-Bundle-Version: 0.8.1.qualifier
-Bundle-ClassPath: .
-Bundle-Activator: org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin
-Bundle-Vendor: %providerName
-Bundle-Localization: plugin
-Export-Package: org.eclipse.papyrus.diagram.statemachine,
- org.eclipse.papyrus.diagram.statemachine.custom.commands,
- org.eclipse.papyrus.diagram.statemachine.custom.edit.part,
- org.eclipse.papyrus.diagram.statemachine.custom.expressions,
- org.eclipse.papyrus.diagram.statemachine.custom.factory,
- org.eclipse.papyrus.diagram.statemachine.custom.figures,
- org.eclipse.papyrus.diagram.statemachine.custom.helpers,
- org.eclipse.papyrus.diagram.statemachine.custom.listeners,
- org.eclipse.papyrus.diagram.statemachine.custom.parsers,
- org.eclipse.papyrus.diagram.statemachine.custom.policies,
- org.eclipse.papyrus.diagram.statemachine.custom.providers,
- org.eclipse.papyrus.diagram.statemachine.edit.commands,
- org.eclipse.papyrus.diagram.statemachine.edit.helpers,
- org.eclipse.papyrus.diagram.statemachine.edit.parts,
- org.eclipse.papyrus.diagram.statemachine.edit.policies,
- org.eclipse.papyrus.diagram.statemachine.navigator,
- org.eclipse.papyrus.diagram.statemachine.parsers,
- org.eclipse.papyrus.diagram.statemachine.part,
- org.eclipse.papyrus.diagram.statemachine.preferences,
- org.eclipse.papyrus.diagram.statemachine.providers,
- org.eclipse.papyrus.diagram.statemachine.sheet
-Require-Bundle: org.eclipse.core.expressions,
- org.eclipse.ui.navigator,
- org.eclipse.gmf.runtime.diagram.ui.properties,
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide,
- org.eclipse.ocl.ecore;visibility:=reexport,
- org.eclipse.ui.navigator.resources,
- org.eclipse.papyrus.core.adaptor.gmf;bundle-version="0.7.0",
- org.eclipse.papyrus.diagram.common;bundle-version="0.7.0",
- org.eclipse.papyrus.preferences,
- org.eclipse.papyrus.extensionpoints.editors,
- org.eclipse.core.runtime,
- org.eclipse.core.resources,
- org.eclipse.jface,
- org.eclipse.ui.ide,
- org.eclipse.ui.views,
- org.eclipse.emf.ecore,
- org.eclipse.emf.ecore.xmi,
- org.eclipse.emf.edit.ui,
- org.eclipse.gmf.runtime.emf.core,
- org.eclipse.gmf.runtime.emf.commands.core,
- org.eclipse.gmf.runtime.emf.ui.properties,
- org.eclipse.gmf.runtime.diagram.ui,
- org.eclipse.gmf.runtime.diagram.ui.providers,
- org.eclipse.gmf.runtime.diagram.ui.providers.ide,
- org.eclipse.gmf.runtime.diagram.ui.render,
- org.eclipse.gmf.runtime.diagram.ui.resources.editor,
- org.eclipse.uml2.uml;visibility:=reexport,
- org.eclipse.uml2.uml.edit;visibility:=reexport,
- org.eclipse.emf.ecore;visibility:=reexport,
- org.eclipse.emf.ecore.edit;visibility:=reexport,
- org.eclipse.emf.validation;visibility:=reexport,
- org.eclipse.gef;visibility:=reexport,
- org.eclipse.papyrus.ui.toolbox;bundle-version="0.8.0",
- org.eclipse.papyrus.navigation.uml
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Ant-Version: Apache Ant 1.7.0
-Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.)
-Eclipse-LazyStart: true
-Bundle-ActivationPolicy: lazy
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/about.html b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/about.html
deleted file mode 100644
index 82d49bf5f81..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 5, 2007</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
-
-</body>
-</html>
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/build.properties b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/build.properties
deleted file mode 100644
index 5463dee2125..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/build.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-#Mon Sep 12 09:29:49 CEST 2011
-output..=bin/
-bin.includes=.,icons/,META-INF/,plugin.xml,plugin.properties,messages.properties,.options,resource/,about.html
-jars.compile.order=.
-src.includes=model/,icons/,about.html,.,META-INF/,plugin.xml,plugin.properties,messages.properties,.options,resource/
-source..=src/,custom-src/,src//
-bin..=bin/
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/CreateStateMachineDiagramCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/CreateStateMachineDiagramCommand.java
deleted file mode 100644
index f38687fed4f..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/CreateStateMachineDiagramCommand.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2008 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Cedric Dumoulin Cedric.Dumoulin@lifl.fr - Initial API and implementation
- * Obeo
- *
- *****************************************************************************/
-package org.eclipse.papyrus.diagram.statemachine;
-
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.commands.CreateBehavioredClassifierDiagramCommand;
-import org.eclipse.papyrus.diagram.common.commands.SemanticAdapter;
-import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.ElementInitializers;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.umlutils.NamedElementUtil;
-import org.eclipse.uml2.uml.BehavioredClassifier;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.Region;
-import org.eclipse.uml2.uml.StateMachine;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * Define a command to create a new StateMachine Diagram. This command is used by all UI (toolbar,
- * outline, creation wizards) to create a new StateMachine Diagram.
- */
-public class CreateStateMachineDiagramCommand extends CreateBehavioredClassifierDiagramCommand {
-
- private StateMachine stateMachine = null;
-
- public final static int defaultX = 30;
-
- public final static int defaultY = 30;
-
- public final static int defaultWidth = 700;
-
- public final static int defaultHeight = 300;
-
- public final static int defaultHeader = 13;
-
- @Override
- protected EClass getBehaviorEClass() {
- return UMLPackage.eINSTANCE.getStateMachine();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getDefaultDiagramName() {
- return "SmDiagram";
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getDiagramNotationID() {
- return PackageEditPart.MODEL_ID;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected PreferencesHint getPreferenceHint() {
- return UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
- }
-
-
- @Override
- protected void initializeDiagram(EObject diagram) {
- if(diagram instanceof Diagram) {
- Diagram diag = (Diagram)diagram;
- if(stateMachine != null) {
- diag.setElement(stateMachine);
- View stateMachineView = ViewService.getInstance().createView(Node.class, new EObjectAdapter(stateMachine), diag, null, ViewUtil.APPEND, true, getPreferenceHint());
- Zone.setX(stateMachineView, defaultX);
- Zone.setY(stateMachineView, defaultY);
- Zone.setWidth(stateMachineView, defaultWidth);
- Zone.setHeight(stateMachineView, defaultHeight);
-
- View compartmentView = null;
-
- Iterator<Node> it = stateMachineView.getChildren().iterator();
-
- while(it.hasNext()) {
- Node currentNode = it.next();
- if(currentNode.getLayoutConstraint() == null) {
- currentNode.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- }
- if(UMLVisualIDRegistry.getVisualID(currentNode.getType()) == StateMachineNameEditPart.VISUAL_ID) {
- Zone.setWidth(currentNode, defaultWidth);
- Zone.setHeight(currentNode, defaultHeader);
- } else if(UMLVisualIDRegistry.getVisualID(currentNode.getType()) == StateMachineCompartmentEditPart.VISUAL_ID) {
- Zone.setY(currentNode, defaultHeader);
- Zone.setWidth(currentNode, defaultWidth);
- Zone.setHeight(currentNode, defaultHeight - defaultHeader);
- compartmentView = currentNode;
- }
- }
-
- Region region = null;
- EList<Region> regions = stateMachine.getRegions();
- if(regions.isEmpty()) {
- region = UMLFactory.eINSTANCE.createRegion();
- regions.add(region);
- region.setName(NamedElementUtil.getDefaultNameWithIncrement(region, regions));
- } else {
- region = stateMachine.getRegions().get(0);
- }
-
- IAdaptable regionAdaptable = new SemanticAdapter(region, null);
- String semanticHint = ((IHintedType)UMLElementTypes.Region_3000).getSemanticHint();
-
- if(compartmentView != null) {
- Node regionNode = ViewService.getInstance().createNode(regionAdaptable, compartmentView, semanticHint, -1, getPreferenceHint());
- if(regionNode.getLayoutConstraint() == null) {
- regionNode.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- }
- // add region specifics
- Zone.createRegionDefaultAnnotation(regionNode);
- Zone.setWidth(regionNode, defaultWidth);
- Zone.setHeight(regionNode, defaultHeight - defaultHeader);
-
- }
- }
- diag.setName(getName());
- }
- }
-
-
- @Override
- protected void initializeModel(EObject owner) {
- if(owner.eClass() == getBehaviorEClass()) {
- stateMachine = (StateMachine)owner;
-
- } else {
- stateMachine = UMLFactory.eINSTANCE.createStateMachine();
-
- if(owner instanceof BehavioredClassifier) {
- BehavioredClassifier behaviorClassifier = (BehavioredClassifier)owner;
- behaviorClassifier.getOwnedBehaviors().add(stateMachine);
-
- } else if(owner instanceof Package) {
- org.eclipse.uml2.uml.Package pack = (org.eclipse.uml2.uml.Package)owner;
- pack.getPackagedElements().add(stateMachine);
-
- }
- ElementInitializers.getInstance().init_StateMachine_2000(stateMachine);
- }
- }
-
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/CreateStateMachineDiagramWithNavigationHandler.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/CreateStateMachineDiagramWithNavigationHandler.java
deleted file mode 100644
index 4929afd52dc..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/CreateStateMachineDiagramWithNavigationHandler.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2011 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.diagram.statemachine;
-
-import org.eclipse.papyrus.navigation.CreateDiagramWithNavigationHandler;
-
-
-public class CreateStateMachineDiagramWithNavigationHandler extends CreateDiagramWithNavigationHandler {
-
- public CreateStateMachineDiagramWithNavigationHandler() {
- super(new CreateStateMachineDiagramCommand(), new StateMachineDiagramCreationCondition());
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/StateMachineDiagramCreationCondition.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/StateMachineDiagramCreationCondition.java
deleted file mode 100644
index b2c5d9c7945..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/StateMachineDiagramCreationCondition.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * Contributors:
- * Atos Origin - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.diagram.statemachine;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.core.extension.commands.PerspectiveContextDependence;
-import org.eclipse.uml2.uml.StateMachine;
-
-/**
- * StateMachineDiagramCreationCondition class allows to check if a State Machine
- * diagram can be added to the selected element.
- */
-public class StateMachineDiagramCreationCondition extends PerspectiveContextDependence {
-
- /**
- * @return whether the diagram can be created.
- */
- public boolean create(EObject selectedElement) {
- if(super.create(selectedElement)) {
- // TODO : to specify according to the spec
- return selectedElement instanceof StateMachine;
- }
- return false;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/StateMachineDiagramEditorFactory.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/StateMachineDiagramEditorFactory.java
deleted file mode 100644
index a6a1cf28ee9..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/StateMachineDiagramEditorFactory.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2008 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Cedric Dumoulin Cedric.Dumoulin@lifl.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.diagram.statemachine;
-
-import org.eclipse.papyrus.core.adaptor.gmf.GmfEditorFactory;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PackageEditPart;
-
-/**
- * @author dumoulin
- *
- */
-public class StateMachineDiagramEditorFactory extends GmfEditorFactory {
-
- /**
- * @param diagramClass
- * @param expectedType
- */
- public StateMachineDiagramEditorFactory() {
- super(UmlStateMachineDiagramForMultiEditor.class, PackageEditPart.MODEL_ID);
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/StateMachineDiagramModelListener.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/StateMachineDiagramModelListener.java
deleted file mode 100644
index 31d2a6f0d17..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/StateMachineDiagramModelListener.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.papyrus.core.listenerservice.IPapyrusListener;
-
-public class StateMachineDiagramModelListener implements IPapyrusListener {
-
- public void notifyChanged(Notification notification) {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/UmlStateMachineDiagramForMultiEditor.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/UmlStateMachineDiagramForMultiEditor.java
deleted file mode 100644
index 221ac34df58..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/UmlStateMachineDiagramForMultiEditor.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2008 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Emilien Perico (Atos Origin) emilien.perico@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.diagram.statemachine;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.common.ui.URIEditorInput;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.LocalSelectionTransfer;
-import org.eclipse.papyrus.core.editor.BackboneException;
-import org.eclipse.papyrus.core.services.ServiceException;
-import org.eclipse.papyrus.core.services.ServicesRegistry;
-import org.eclipse.papyrus.diagram.common.listeners.DropTargetListener;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditor;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.PartInitException;
-
-/**
- * Editor used in multitabs editor.
- *
- * @author Emilien Perico
- *
- */
-public class UmlStateMachineDiagramForMultiEditor extends UMLDiagramEditor {
-
- /**
- * The location of diagram icon in the plug-in
- */
- private static final String DIAG_IMG_PATH = "icons/obj16/Diagram_StateMachine.gif";
-
- /**
- * The image descriptor of the diagram icon
- */
- private static final ImageDescriptor DIAG_IMG_DESC = UMLDiagramEditorPlugin.getBundledImageDescriptor(UmlStateMachineDiagramForMultiEditor.DIAG_IMG_PATH);
-
- /** The editor splitter. */
- private Composite splitter;
-
- /**
- * Constructor for SashSystem v2. Context and required objects are retrieved
- * from the ServiceRegistry.
- *
- * @throws BackboneException
- * @throws ServiceException
- *
- * @generated NOT
- */
- public UmlStateMachineDiagramForMultiEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws BackboneException, ServiceException {
- super(servicesRegistry, diagram);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void createGraphicalViewer(Composite parent) {
- splitter = parent;
- super.createGraphicalViewer(parent);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getEditingDomainID() {
- return "org.eclipse.papyrus.diagram.statemachine.EditingDomain";
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- super.init(site, input);
- setPartName(getDiagram().getName());
- setTitleImage(DIAG_IMG_DESC.createImage());
- }
-
- @Override
- protected void initializeGraphicalViewer() {
- super.initializeGraphicalViewer();
-
- // Enable Drop
- getDiagramGraphicalViewer().addDropTargetListener(new DropTargetListener(getDiagramGraphicalViewer(), LocalSelectionTransfer.getTransfer()) {
-
- @Override
- protected Object getJavaObject(TransferData data) {
- return LocalSelectionTransfer.getTransfer().nativeToJava(data);
- }
-
- @Override
- protected TransactionalEditingDomain getTransactionalEditingDomain() {
- return getEditingDomain();
- }
- });
-
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setFocus() {
- splitter.setFocus();
- super.setFocus();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setInput(IEditorInput input) {
- try {
- // Provide an URI with fragment in order to reuse the same Resource
- // and set the diagram to the fragment.
- URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(getDiagram()));
- doSetInput(uriInput, true);
- } catch (CoreException x) {
- String title = "Problem opening";
- String msg = "Cannot open input element:";
- Shell shell = getSite().getShell();
- ErrorDialog.openError(shell, title, msg, x.getStatus());
- }
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CreateViewCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CreateViewCommand.java
deleted file mode 100644
index f0fcfbf76f7..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CreateViewCommand.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.diagram.statemachine.custom.commands;
-
-
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
-import org.eclipse.gmf.runtime.notation.View;
-
-public class CreateViewCommand extends CreateCommand {
-
- public CreateViewCommand(TransactionalEditingDomain editingDomain, ViewDescriptor viewDescriptor, View containerView) {
- super(editingDomain, viewDescriptor, containerView);
- }
-
- @Override
- public boolean canExecute() {
- return true;
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomCompositeStateSetBoundsCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomCompositeStateSetBoundsCommand.java
deleted file mode 100644
index f0ebbc28ca7..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomCompositeStateSetBoundsCommand.java
+++ /dev/null
@@ -1,157 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.commands;
-
-import java.util.Iterator;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-
-public class CustomCompositeStateSetBoundsCommand extends AbstractTransactionalCommand {
-
- CreateViewRequest.ViewDescriptor viewDescriptor;
-
- Rectangle rect;
-
- Point location;
-
- Dimension size;
-
- boolean isComposite = false;
-
- public CustomCompositeStateSetBoundsCommand(TransactionalEditingDomain domain, String label, CreateViewRequest.ViewDescriptor viewDescriptor, Rectangle rect, boolean isComposite) {
- super(domain, label, null);
-
- this.viewDescriptor = viewDescriptor;
-
- this.rect = rect;
- location = rect.getLocation();
- size = rect.getSize();
-
- this.isComposite = isComposite;
-
- // make sure the return object is available even before
- // executing/undoing/redoing
- setResult(CommandResult.newOKCommandResult(viewDescriptor));
- }
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- View stateView = (View)viewDescriptor.getAdapter(View.class);
- if(location != null) {
- Zone.setX(stateView, location.x);
- Zone.setY(stateView, location.y);
- }
- if((size != null) && !size.equals(-1, -1)) {
- Zone.setWidth(stateView, size.width);
- Zone.setHeight(stateView, size.height);
- } else {
- Zone.setWidth(stateView, Zone.defaultWidth);
- Zone.setHeight(stateView, Zone.defaultHeight);
- }
-
- if(!isComposite) {
- Iterator<Node> it = stateView.getChildren().iterator();
-
- while(it.hasNext()) {
- Node currentNode = it.next();
- if(currentNode.getLayoutConstraint() == null) {
- currentNode.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- }
- if(UMLVisualIDRegistry.getVisualID(currentNode.getType()) == StateNameEditPart.VISUAL_ID) {
- if((size != null) && !size.equals(-1, -1)) {
- Zone.setWidth(currentNode, size.width);
- Zone.setHeight(currentNode, size.height);
- } else {
- Zone.setWidth(currentNode, 40);
- Zone.setHeight(currentNode, 40);
- }
- } else if(UMLVisualIDRegistry.getVisualID(currentNode.getType()) == StateCompartmentEditPart.VISUAL_ID) {
- Zone.setY(currentNode, 40);
- if((size != null) && !size.equals(-1, -1)) {
- Zone.setWidth(currentNode, size.width);
- Zone.setHeight(currentNode, 0);
- } else {
- Zone.setWidth(currentNode, 40);
- Zone.setHeight(currentNode, 0);
- }
-
- }
- }
- } else {
- Iterator<Node> it = stateView.getChildren().iterator();
-
- while(it.hasNext()) {
- Node currentNode = it.next();
- if(currentNode.getLayoutConstraint() == null) {
- currentNode.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- }
- if(UMLVisualIDRegistry.getVisualID(currentNode.getType()) == StateNameEditPart.VISUAL_ID) {
- if((size != null) && !size.equals(-1, -1)) {
- Zone.setWidth(currentNode, size.width);
- Zone.setHeight(currentNode, Zone.defaultHeader);
- } else {
- Zone.setWidth(currentNode, Zone.defaultWidth);
- Zone.setHeight(currentNode, Zone.defaultHeader);
- }
- } else if(UMLVisualIDRegistry.getVisualID(currentNode.getType()) == StateCompartmentEditPart.VISUAL_ID) {
- Zone.setY(currentNode, Zone.defaultHeader);
- if((size != null) && !size.equals(-1, -1)) {
- Zone.setWidth(currentNode, size.width);
- Zone.setHeight(currentNode, size.height - Zone.defaultHeader);
- } else {
- Zone.setWidth(currentNode, Zone.defaultWidth);
- Zone.setHeight(currentNode, Zone.defaultHeight - Zone.defaultHeader);
- }
- int nRegions = currentNode.getChildren().size();
- String prefix = "";
- String zone = "";
- int i = 0;
- int width = 0;
- Iterator<Node> subit = currentNode.getChildren().iterator();
- while(subit.hasNext()) {
- Node subCurrentNode = subit.next();
- if(subCurrentNode.getLayoutConstraint() == null) {
- subCurrentNode.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- }
- if(UMLVisualIDRegistry.getVisualID(subCurrentNode.getType()) == RegionEditPart.VISUAL_ID) {
- if((size != null) && !size.equals(-1, -1)) {
- Zone.setWidth(subCurrentNode, (i == nRegions - 1) ? size.width - width : size.width / nRegions);
- Zone.setHeight(subCurrentNode, size.height - Zone.defaultHeader);
- Zone.setX(subCurrentNode, width);
- width += size.width / nRegions;
- } else {
- Zone.setWidth(subCurrentNode, (i == nRegions - 1) ? Zone.defaultWidth - width : Zone.defaultWidth / nRegions);
- Zone.setHeight(subCurrentNode, Zone.defaultHeight - Zone.defaultHeader);
- Zone.setX(subCurrentNode, width);
- width += Zone.defaultWidth / nRegions;
- }
- zone = (i == nRegions - 1) ? prefix : prefix + Zone.LEFT;
- Zone.setZone(subCurrentNode, zone);
- prefix = prefix + Zone.RIGHT;
- i++;
- }
- }
-
- }
- }
- }
-
- return CommandResult.newOKCommandResult();
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomCompositeStateWithDefaultRegionCreateNodeCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomCompositeStateWithDefaultRegionCreateNodeCommand.java
deleted file mode 100644
index 5d1f39831d6..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomCompositeStateWithDefaultRegionCreateNodeCommand.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.commands;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.commands.SemanticAdapter;
-import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.uml2.uml.Region;
-import org.eclipse.uml2.uml.State;
-
-public class CustomCompositeStateWithDefaultRegionCreateNodeCommand extends AbstractTransactionalCommand {
-
- IAdaptable adaptable;
-
- PreferencesHint prefHints;
-
- CreateViewRequest.ViewDescriptor viewDescriptor;
-
- public CustomCompositeStateWithDefaultRegionCreateNodeCommand(IAdaptable adaptable, PreferencesHint prefHints, TransactionalEditingDomain domain, String label, List affectedFiles) {
- super(domain, label, affectedFiles);
- this.adaptable = adaptable;
- this.prefHints = prefHints;
-
- viewDescriptor = new ViewDescriptor(adaptable, prefHints);
-
- // make sure the return object is available even before
- // executing/undoing/redoing
- setResult(CommandResult.newOKCommandResult(viewDescriptor));
- }
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- // adapt the view at execution time
- View stateView = (View)adaptable.getAdapter(View.class);
-
- View compartmentView = null;
-
- Iterator<View> it = stateView.getChildren().iterator();
- while((compartmentView == null) && it.hasNext()) {
- View currentView = (View)it.next();
- if(UMLVisualIDRegistry.getVisualID(currentView.getType()) == StateCompartmentEditPart.VISUAL_ID)
- compartmentView = currentView;
- }
-
- State state = (State)stateView.getElement();
-
- Iterator<Region> regions = state.getRegions().iterator();
- while(regions.hasNext()) {
- Region region = regions.next();
-
- IAdaptable regionAdaptable = new SemanticAdapter(region, null);
- String semanticHint = ((IHintedType)UMLElementTypes.Region_3000).getSemanticHint();
-
- if(compartmentView != null) {
- Node regionNode = ViewService.getInstance().createNode(regionAdaptable, compartmentView, semanticHint, -1, prefHints);
-
- // add region specifics
- Zone.createRegionDefaultAnnotation(regionNode);
-
- if(regionNode != null) {
- viewDescriptor.setView(regionNode);
- }
-
- }
- }
- return CommandResult.newOKCommandResult(viewDescriptor);
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomConnectionPointReferenceCreateCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomConnectionPointReferenceCreateCommand.java
deleted file mode 100644
index 1aab9c6f6e9..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomConnectionPointReferenceCreateCommand.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.commands;
-
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.ConnectionPointReferenceCreateCommand;
-import org.eclipse.uml2.uml.State;
-
-
-public class CustomConnectionPointReferenceCreateCommand extends ConnectionPointReferenceCreateCommand {
-
- public CustomConnectionPointReferenceCreateCommand(CreateElementRequest req) {
- super(req);
- // TODO Auto-generated constructor stub
- }
-
- @Override
- public boolean canExecute() {
- State owner = (State)getElementToEdit();
- if(owner.getRegions().isEmpty() && (owner.getSubmachine() != null))
- return true;
- return false;
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomFirstRegionInCompositeStateCreateElementCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomFirstRegionInCompositeStateCreateElementCommand.java
deleted file mode 100644
index fb91e04a833..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomFirstRegionInCompositeStateCreateElementCommand.java
+++ /dev/null
@@ -1,180 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.commands;
-
-import java.util.Iterator;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
-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.Node;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.commands.SemanticAdapter;
-import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.ElementInitializers;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.uml2.uml.Region;
-import org.eclipse.uml2.uml.State;
-import org.eclipse.uml2.uml.UMLFactory;
-
-public class CustomFirstRegionInCompositeStateCreateElementCommand extends AbstractTransactionalCommand {
-
- IAdaptable adaptable;
-
- IAdaptable adaptableForDropped = null;
-
- PreferencesHint prefHints;
-
- CreateViewRequest.ViewDescriptor viewDescriptor;
-
- CreateElementRequest createElementRequest;
-
- String dropLocation = Zone.NONE;
-
- public CustomFirstRegionInCompositeStateCreateElementCommand(IAdaptable adaptable, IAdaptable adaptableForDropped, PreferencesHint prefHints, TransactionalEditingDomain domain, String label, String dropLocation) {
- super(domain, label, null);
- this.adaptable = adaptable;
- this.adaptableForDropped = adaptableForDropped;
- this.prefHints = prefHints;
-
- viewDescriptor = new ViewDescriptor(adaptable, prefHints);
-
- // make sure the return object is available even before
- // executing/undoing/redoing
- setResult(CommandResult.newOKCommandResult(viewDescriptor));
-
- this.dropLocation = dropLocation;
- }
-
- @Override
- public boolean canExecute() {
- View compartment = (View)adaptable.getAdapter(View.class);
- if(compartment.getChildren().isEmpty()) {
- View owner = (View)compartment.eContainer();
- State state = (State)owner.getElement();
- if(state.getSubmachine() == null)
- return true;
- return false;
- }
- // CHECK THIS
- // else{
- // ENamedElement namedElement = PackageUtil.getElement("notation.View.visible");
- // if(ViewUtil.getStructuralFeatureValue(compartment, (EStructuralFeature)namedElement).equals(new Boolean(false))){
- // SetPropertyCommand showCompartment = new SetPropertyCommand(getEditingDomain(), adaptable, "notation.View.visible", "Visibility", true);
- // showCompartment.setOptions(Collections.singletonMap(Transaction.OPTION_UNPROTECTED, Boolean.TRUE));
- //
- // try {
- // showCompartment.execute(null, null);
- // } catch (ExecutionException e) {
- // }
- //
- // }
- // return false;
- // }
- return false;
- }
-
- protected void doConfigure(Region newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = createElementRequest.getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(createElementRequest.getClientContext());
- configureRequest.addParameters(createElementRequest.getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if(configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- // adapt the view at execution time
- View compartment = (View)adaptable.getAdapter(View.class);
- View ownerView = (View)compartment.eContainer();
-
- // get state bounds
- int height = Zone.getHeight(ownerView);
- int width = Zone.getWidth(ownerView);
- if(height < Zone.defaultHeight) {
- height = Zone.defaultHeight;
- Zone.setHeight(ownerView, height);
- }
- if(width < Zone.defaultWidth) {
- width = Zone.defaultWidth;
- Zone.setWidth(ownerView, width);
- }
-
-
- if(adaptableForDropped == null) {
- Region umlRegion = UMLFactory.eINSTANCE.createRegion();
-
- createElementRequest = new CreateElementRequest(getEditingDomain(), ownerView, UMLElementTypes.Region_3000);
-
- State umlState = (State)ownerView.getElement();
- umlState.getRegions().add(umlRegion);
-
- ElementInitializers.getInstance().init_Region_3000(umlRegion);
-
- doConfigure(umlRegion, monitor, info);
-
- adaptableForDropped = new SemanticAdapter(umlRegion, null);
- }
-
- // create a view for the new region on the stateMachineCompartment
- String semanticHint = ((IHintedType)UMLElementTypes.Region_3000).getSemanticHint();
- View newRegion = (View)ViewService.getInstance().createNode(adaptableForDropped, compartment, semanticHint, -1, prefHints);
-
- // add region specific annotation
- Zone.createRegionDefaultAnnotation(newRegion);
-
- // adjust bounds and zone
-
- Iterator<Node> it = ownerView.getChildren().iterator();
-
- while(it.hasNext()) {
- Node currentNode = it.next();
- if(currentNode.getLayoutConstraint() == null) {
- currentNode.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- }
- if(UMLVisualIDRegistry.getVisualID(currentNode.getType()) == StateNameEditPart.VISUAL_ID) {
- Zone.setWidth(currentNode, width);
- Zone.setHeight(currentNode, Zone.defaultHeader);
- } else if(UMLVisualIDRegistry.getVisualID(currentNode.getType()) == StateCompartmentEditPart.VISUAL_ID) {
- Zone.setY(currentNode, Zone.defaultHeader);
- Zone.setWidth(currentNode, width);
- Zone.setHeight(currentNode, height - Zone.defaultHeader);
-
- Iterator<Node> subit = currentNode.getChildren().iterator();
- while(subit.hasNext()) {
- Node subCurrentNode = subit.next();
- if(subCurrentNode.getLayoutConstraint() == null) {
- subCurrentNode.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- }
- if(UMLVisualIDRegistry.getVisualID(subCurrentNode.getType()) == RegionEditPart.VISUAL_ID) {
- Zone.setWidth(subCurrentNode, width);
- Zone.setHeight(subCurrentNode, height - Zone.defaultHeader);
- }
- }
- }
-
- }
- viewDescriptor.setView(newRegion);
-
- return CommandResult.newOKCommandResult(viewDescriptor);
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomPseudostateEntryPointCreateCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomPseudostateEntryPointCreateCommand.java
deleted file mode 100644
index 9adbe48c4c1..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomPseudostateEntryPointCreateCommand.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.PseudostateEntryPointCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Pseudostate;
-import org.eclipse.uml2.uml.State;
-import org.eclipse.uml2.uml.UMLFactory;
-
-
-public class CustomPseudostateEntryPointCreateCommand extends PseudostateEntryPointCreateCommand {
-
- public CustomPseudostateEntryPointCreateCommand(CreateElementRequest req) {
- super(req);
- // TODO Auto-generated constructor stub
- }
-
- @Override
- public boolean canExecute() {
- State owner = (State)getElementToEdit();
- if(owner.getRegions().isEmpty())
- return false;
- return true;
- }
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- Pseudostate newElement = UMLFactory.eINSTANCE.createPseudostate();
-
- State owner = (State)getElementToEdit();
- owner.getConnectionPoints().add(newElement);
- ElementInitializers.getInstance().init_Pseudostate_16000(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest)getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomPseudostateExitPointCreateCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomPseudostateExitPointCreateCommand.java
deleted file mode 100644
index 3bd8b517445..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomPseudostateExitPointCreateCommand.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.PseudostateExitPointCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Pseudostate;
-import org.eclipse.uml2.uml.State;
-import org.eclipse.uml2.uml.UMLFactory;
-
-
-public class CustomPseudostateExitPointCreateCommand extends PseudostateExitPointCreateCommand {
-
- public CustomPseudostateExitPointCreateCommand(CreateElementRequest req) {
- super(req);
- // TODO Auto-generated constructor stub
- }
-
- @Override
- public boolean canExecute() {
- State owner = (State)getElementToEdit();
- if(owner.getRegions().isEmpty())
- return false;
- return true;
- }
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- Pseudostate newElement = UMLFactory.eINSTANCE.createPseudostate();
-
- State owner = (State)getElementToEdit();
- owner.getConnectionPoints().add(newElement);
- ElementInitializers.getInstance().init_Pseudostate_17000(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest)getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomRegionCreateElementCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomRegionCreateElementCommand.java
deleted file mode 100644
index ebd01e68f3a..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomRegionCreateElementCommand.java
+++ /dev/null
@@ -1,198 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.commands.SemanticAdapter;
-import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone;
-import org.eclipse.papyrus.diagram.statemachine.providers.ElementInitializers;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.uml2.uml.Region;
-import org.eclipse.uml2.uml.State;
-import org.eclipse.uml2.uml.StateMachine;
-import org.eclipse.uml2.uml.UMLFactory;
-
-public class CustomRegionCreateElementCommand extends AbstractTransactionalCommand {
-
- IAdaptable adaptable;
-
- IAdaptable adaptableForDropped = null;
-
- PreferencesHint prefHints;
-
- CreateViewRequest.ViewDescriptor viewDescriptor;
-
- CreateElementRequest createElementRequest;
-
- String dropLocation = Zone.RIGHT;
-
- public CustomRegionCreateElementCommand(IAdaptable adaptable, IAdaptable adaptableForDropped, PreferencesHint prefHints, TransactionalEditingDomain domain, String label, String dropLocation) {
- super(domain, label, null);
- this.adaptable = adaptable;
- this.adaptableForDropped = adaptableForDropped;
- this.prefHints = prefHints;
-
- viewDescriptor = new ViewDescriptor(adaptable, prefHints);
-
- // make sure the return object is available even before
- // executing/undoing/redoing
- setResult(CommandResult.newOKCommandResult(viewDescriptor));
-
- this.dropLocation = dropLocation;
- }
-
- protected void doConfigure(Region newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = createElementRequest.getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(createElementRequest.getClientContext());
- configureRequest.addParameters(createElementRequest.getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if(configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- // adapt the view at execution time
- View existingRegion = (View)adaptable.getAdapter(View.class);
-
- // get existingRegion bounds (i.e. the space which needs to be divided)
- int height = Zone.getHeight(existingRegion);
- int width = Zone.getWidth(existingRegion);
- int x = Zone.getX(existingRegion);
- int y = Zone.getY(existingRegion);
-
- // get the stateMachine/state via the stateMachineView/stateView
- View compartment = (View)existingRegion.eContainer();
- View ownerView = (View)compartment.eContainer();
-
- if(adaptableForDropped == null) {
- Region umlRegion = UMLFactory.eINSTANCE.createRegion();
-
- createElementRequest = new CreateElementRequest(getEditingDomain(), ownerView, UMLElementTypes.Region_3000);
-
- // create a new UML region
- if(ownerView.getElement() instanceof StateMachine) {
- StateMachine umlStateMachine = (StateMachine)ownerView.getElement();
- umlStateMachine.getRegions().add(umlRegion);
- } else if(ownerView.getElement() instanceof State) {
- State umlState = (State)ownerView.getElement();
- umlState.getRegions().add(umlRegion);
- }
-
- ElementInitializers.getInstance().init_Region_3000(umlRegion);
-
- doConfigure(umlRegion, monitor, info);
-
- adaptableForDropped = new SemanticAdapter(umlRegion, null);
- }
-
- // create a view for the new region on the stateMachineCompartment
- String semanticHint = ((IHintedType)UMLElementTypes.Region_3000).getSemanticHint();
- View newRegion = (View)ViewService.getInstance().createNode(adaptableForDropped, compartment, semanticHint, -1, prefHints);
-
- // add region specific annotation
- Zone.createRegionDefaultAnnotation(newRegion);
-
- // adjust bounds and zone
-
- // the test itself and change of bounds
- if(Zone.isRight(dropLocation)) {
- // the new region zone should reflect that of other branch
- Zone.copyZone(existingRegion, newRegion);
- // now set new region as RIGHT
- Zone.setRight(newRegion);
- // and existing region to LEFT
- Zone.setLeft(existingRegion);
-
- // shrink width of existing region
- width *= 0.5;
- Zone.setWidth(existingRegion, width);
- // new region will have same height and width
- Zone.setWidth(newRegion, width);
- Zone.setHeight(newRegion, height);
-
- // set new region to location (x+width,y) (existing region is not
- // moved)
- Zone.setX(newRegion, x + width);
- Zone.setY(newRegion, y);
- } else if(Zone.isLeft(dropLocation)) {
- // the new region zone should reflect that of existing region
- Zone.copyZone(existingRegion, newRegion);
- // now set new region as LEFT
- Zone.setLeft(newRegion);
- // and existing region to RIGHT
- Zone.setRight(existingRegion);
-
- // shrink width of existing region
- width *= 0.5;
- Zone.setWidth(existingRegion, width);
- // new region will have same height and width
- Zone.setWidth(newRegion, width);
- Zone.setHeight(newRegion, height);
-
- // set existing region to location (x+width,y) and new region at
- // (x,y)
- Zone.setX(existingRegion, x + width);
- Zone.setX(newRegion, x);
- Zone.setY(newRegion, y);
- } else if(Zone.isBottom(dropLocation)) {
- // the new region zone should reflect that of existing region
- Zone.copyZone(existingRegion, newRegion);
- // now set new region as BOTTOM
- Zone.setBottom(newRegion);
- // and existing region to TOP
- Zone.setTop(existingRegion);
-
- // shrink height of existing region
- height *= 0.5;
- Zone.setHeight(existingRegion, height);
- // new region will have same height and width
- Zone.setWidth(newRegion, width);
- Zone.setHeight(newRegion, height);
-
- // set new region to location (x,y+height) (existing region is not
- // moved)
- Zone.setX(newRegion, x);
- Zone.setY(newRegion, y + height);
- } else if(Zone.isTop(dropLocation)) {
- // the new region zone should reflect that of existing region
- Zone.copyZone(existingRegion, newRegion);
- // now set new region as TOP
- Zone.setTop(newRegion);
- // and existing region to BOTTOM
- Zone.setBottom(existingRegion);
-
- // shrink height of existing region
- height *= 0.5;
- Zone.setHeight(existingRegion, height);
- // new region will have same height and width
- Zone.setWidth(newRegion, width);
- Zone.setHeight(newRegion, height);
-
- // set existing region to location (x,y+height) and new region at
- // (x,y)
- Zone.setY(existingRegion, y + height);
- Zone.setX(newRegion, x);
- Zone.setY(newRegion, y);
- }
- viewDescriptor.setView(newRegion);
-
- return CommandResult.newOKCommandResult(viewDescriptor);
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomRegionDeleteCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomRegionDeleteCommand.java
deleted file mode 100644
index 8849a8c6372..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomRegionDeleteCommand.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.commands;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone;
-import org.eclipse.uml2.uml.StateMachine;
-
-public class CustomRegionDeleteCommand extends DeleteCommand {
-
- public CustomRegionDeleteCommand(TransactionalEditingDomain editingDomain, View view) {
- super(editingDomain, view);
- // TODO Auto-generated constructor stub
- }
-
- /*
- * Prevents the removal of the last region displayed in the state machine or composite state
- */
- @Override
- public boolean canExecute() {
- View compartment = (View)getView().eContainer();
- if(compartment.getElement() instanceof StateMachine) {
- if(compartment.getChildren().size() != 1)
- return true;
- return false;
- }
- return true;
- }
-
- /*
- * Essentially performs a resize of the region to be removed so that
- * neighbouring regions are updated accordingly, then resets the zone of
- * neighbouring regions and finally remove the region
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
- // get the region to delete
- View region = getView();
- View compartment = (View)region.eContainer();
- if(compartment.getChildren().size() != 1) {
- int regionWidth = Zone.getWidth(region);
- int regionHeight = Zone.getHeight(region);
-
- String s = Zone.getZone(region);
- List<View> neighbours = null;
- if(Zone.isRight(s)) {
- neighbours = Zone.getRegionLeftBorderOutsideNeighbours(region);
- Iterator<View> it = neighbours.iterator();
- while(it.hasNext()) {
- View view = it.next();
- // for each of these we add regionWidth to their width
- int width = Zone.getWidth(view);
- width += regionWidth;
- Zone.setWidth(view, width);
- }
- } else if(Zone.isLeft(s)) {
- neighbours = Zone.getRegionRightBorderOutsideNeighbours(region);
- Iterator<View> it = neighbours.iterator();
- while(it.hasNext()) {
- View view = it.next();
- // for each of these we add regionWidth to their width and
- // translate their x of
- // -regionWidth
- int width = Zone.getWidth(view);
- width += regionWidth;
- Zone.setWidth(view, width);
- int x = Zone.getX(view);
- x -= regionWidth;
- Zone.setX(view, x);
- }
- } else if(Zone.isTop(s)) {
- neighbours = Zone.getRegionBottomBorderOutsideNeighbours(region);
- Iterator<View> it = neighbours.iterator();
- while(it.hasNext()) {
- View view = it.next();
- // for each of these we add regionHeight to their height and
- // -regionHeight to their
- // y
- int height = Zone.getHeight(view);
- height += regionHeight;
- Zone.setHeight(view, height);
- int y = Zone.getY(view);
- y -= regionHeight;
- Zone.setY(view, y);
- }
- } else if(Zone.isBottom(s)) {
- neighbours = Zone.getRegionTopBorderOutsideNeighbours(region);
- Iterator<View> it = neighbours.iterator();
- while(it.hasNext()) {
- View view = it.next();
- // for each of these we add regionHeight to their height
- int height = Zone.getHeight(view);
- height += regionHeight;
- Zone.setHeight(view, height);
- }
- }
-
- // set the zone accordingly
- // get its counterpart
- Zone.resetRegionCounterpartZone(region);
- }
- ViewUtil.destroy(region);
- return CommandResult.newOKCommandResult();
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomRegionDestroyElementCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomRegionDestroyElementCommand.java
deleted file mode 100644
index b6221d701c2..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomRegionDestroyElementCommand.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.uml2.uml.StateMachine;
-
-/*
- * The default command is fine only the canExecute needs to be changed to
- * prevent deletion of the last region of a state machine
- */
-public class CustomRegionDestroyElementCommand extends DestroyElementCommand {
-
- public CustomRegionDestroyElementCommand(DestroyElementRequest request) {
- super(request);
- }
-
- @Override
- public boolean canExecute() {
- if(super.canExecute()) {
- if(getElementToEdit() instanceof StateMachine) {
- StateMachine stateMachine = (StateMachine)getElementToEdit();
- if(stateMachine.getRegions().size() == 1)
- return false;
- return true;
- }
- return true;
- // else if(getElementToEdit() instanceof State){
- // State state = (State)getElementToEdit();
- // if(state.getRegions().size() == 1)
- // return false;
- // return true;
- // }
- }
- return false;
- }
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- // TODO Auto-generated method stub
- return super.doExecuteWithResult(monitor, info);
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomRegionMoveCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomRegionMoveCommand.java
deleted file mode 100644
index 8bd0f96ea36..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomRegionMoveCommand.java
+++ /dev/null
@@ -1,215 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.commands;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone;
-
-public class CustomRegionMoveCommand extends AbstractTransactionalCommand {
-
-
- IAdaptable adaptableForTargetRegion;
-
- IAdaptable adaptableForRegionToMove;
-
- String dropLocation = Zone.RIGHT;
-
- PreferencesHint prefHints;
-
- CreateViewRequest.ViewDescriptor viewDescriptor;
-
-
- public CustomRegionMoveCommand(IAdaptable adaptableForTargetRegion, IAdaptable adaptableForRegionToMove, PreferencesHint prefHints, TransactionalEditingDomain domain, String label, String dropLocation) {
- super(domain, label, null);
- this.adaptableForTargetRegion = adaptableForTargetRegion;
- this.adaptableForRegionToMove = adaptableForRegionToMove;
- this.prefHints = prefHints;
-
- viewDescriptor = new ViewDescriptor(adaptableForRegionToMove, prefHints);
-
- // make sure the return object is available even before
- // executing/undoing/redoing
- setResult(CommandResult.newOKCommandResult(viewDescriptor));
-
- this.dropLocation = dropLocation;
- }
-
- /*
- * Essentially performs a resize of the region to be removed so that
- * neighbouring regions are updated accordingly, then resets the zone of
- * neighbouring regions and finally remove the region
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
- // adapt the view of the existing region
- View targetRegion = (View)adaptableForTargetRegion.getAdapter(View.class);
- // adapt the view of the dropped region
- View regionToMove = (View)adaptableForRegionToMove.getAdapter(View.class);
-
- // manage the fake removal of regionToMove
- View compartment = (View)regionToMove.eContainer();
- if(compartment.getChildren().size() != 1) {
- int regionWidth = Zone.getWidth(regionToMove);
- int regionHeight = Zone.getHeight(regionToMove);
-
- String s = Zone.getZone(regionToMove);
- List<View> neighbours = null;
- if(Zone.isRight(s)) {
- neighbours = Zone.getRegionLeftBorderOutsideNeighbours(regionToMove);
- Iterator<View> it = neighbours.iterator();
- while(it.hasNext()) {
- View view = it.next();
- // for each of these we add regionWidth to their width
- int width = Zone.getWidth(view);
- width += regionWidth;
- Zone.setWidth(view, width);
- }
- } else if(Zone.isLeft(s)) {
- neighbours = Zone.getRegionRightBorderOutsideNeighbours(regionToMove);
- Iterator<View> it = neighbours.iterator();
- while(it.hasNext()) {
- View view = it.next();
- // for each of these we add regionWidth to their width and
- // translate their x of
- // -regionWidth
- int width = Zone.getWidth(view);
- width += regionWidth;
- Zone.setWidth(view, width);
- int x = Zone.getX(view);
- x -= regionWidth;
- Zone.setX(view, x);
- }
- } else if(Zone.isTop(s)) {
- neighbours = Zone.getRegionBottomBorderOutsideNeighbours(regionToMove);
- Iterator<View> it = neighbours.iterator();
- while(it.hasNext()) {
- View view = it.next();
- // for each of these we add regionHeight to their height and
- // -regionHeight to their
- // y
- int height = Zone.getHeight(view);
- height += regionHeight;
- Zone.setHeight(view, height);
- int y = Zone.getY(view);
- y -= regionHeight;
- Zone.setY(view, y);
- }
- } else if(Zone.isBottom(s)) {
- neighbours = Zone.getRegionTopBorderOutsideNeighbours(regionToMove);
- Iterator<View> it = neighbours.iterator();
- while(it.hasNext()) {
- View view = it.next();
- // for each of these we add regionHeight to their height
- int height = Zone.getHeight(view);
- height += regionHeight;
- Zone.setHeight(view, height);
- }
- }
-
- // set the zone accordingly
- // get its counterpart
- Zone.resetRegionCounterpartZone(regionToMove);
- }
-
- // now perform the move
- // get targetRegion bounds (i.e. the space which needs to be divided)
- int height = Zone.getHeight(targetRegion);
- int width = Zone.getWidth(targetRegion);
- int x = Zone.getX(targetRegion);
- int y = Zone.getY(targetRegion);
-
- // the test itself and change of bounds
- if(Zone.isRight(dropLocation)) {
- // the new region zone should reflect that of other branch
- Zone.copyZone(targetRegion, regionToMove);
- // now set new region as RIGHT
- Zone.setRight(regionToMove);
- // and existing region to LEFT
- Zone.setLeft(targetRegion);
-
- // shrink width of existing region
- width *= 0.5;
- Zone.setWidth(targetRegion, width);
- // new region will have same height and width
- Zone.setWidth(regionToMove, width);
- Zone.setHeight(regionToMove, height);
-
- // set new region to location (x+width,y) (existing region is not
- // moved)
- Zone.setX(regionToMove, x + width);
- Zone.setY(regionToMove, y);
- } else if(Zone.isLeft(dropLocation)) {
- // the new region zone should reflect that of existing region
- Zone.copyZone(targetRegion, regionToMove);
- // now set new region as LEFT
- Zone.setLeft(regionToMove);
- // and existing region to RIGHT
- Zone.setRight(targetRegion);
-
- // shrink width of existing region
- width *= 0.5;
- Zone.setWidth(targetRegion, width);
- // new region will have same height and width
- Zone.setWidth(regionToMove, width);
- Zone.setHeight(regionToMove, height);
-
- // set existing region to location (x+width,y) and new region at
- // (x,y)
- Zone.setX(targetRegion, x + width);
- Zone.setX(regionToMove, x);
- Zone.setY(regionToMove, y);
- } else if(Zone.isBottom(dropLocation)) {
- // the new region zone should reflect that of existing region
- Zone.copyZone(targetRegion, regionToMove);
- // now set new region as BOTTOM
- Zone.setBottom(regionToMove);
- // and existing region to TOP
- Zone.setTop(targetRegion);
-
- // shrink height of existing region
- height *= 0.5;
- Zone.setHeight(targetRegion, height);
- // new region will have same height and width
- Zone.setWidth(regionToMove, width);
- Zone.setHeight(regionToMove, height);
-
- // set new region to location (x,y+height) (existing region is not
- // moved)
- Zone.setX(regionToMove, x);
- Zone.setY(regionToMove, y + height);
- } else if(Zone.isTop(dropLocation)) {
- // the new region zone should reflect that of existing region
- Zone.copyZone(targetRegion, regionToMove);
- // now set new region as TOP
- Zone.setTop(regionToMove);
- // and existing region to BOTTOM
- Zone.setBottom(targetRegion);
-
- // shrink height of existing region
- height *= 0.5;
- Zone.setHeight(targetRegion, height);
- // new region will have same height and width
- Zone.setWidth(regionToMove, width);
- Zone.setHeight(regionToMove, height);
-
- // set existing region to location (x,y+height) and new region at
- // (x,y)
- Zone.setY(targetRegion, y + height);
- Zone.setX(regionToMove, x);
- Zone.setY(regionToMove, y);
- }
- viewDescriptor.setView(regionToMove);
-
- return CommandResult.newOKCommandResult();
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomRegionResizeCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomRegionResizeCommand.java
deleted file mode 100644
index 68491a47b0a..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomRegionResizeCommand.java
+++ /dev/null
@@ -1,193 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.commands;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone;
-
-public class CustomRegionResizeCommand extends AbstractTransactionalCommand {
-
- CreateViewRequest.ViewDescriptor viewDescriptor;
-
- IAdaptable adaptable;
-
- PreferencesHint prefHints;
-
- /**
- * The request to perform.
- */
- private ChangeBoundsRequest request = null;
-
- /**
- * The bounds rectangle.
- */
- private Rectangle bounds = null;
-
- public CustomRegionResizeCommand(IAdaptable adaptable, PreferencesHint prefHints, TransactionalEditingDomain domain, String label, ChangeBoundsRequest request, Rectangle bounds) {
- super(domain, label, null);
-
- this.adaptable = adaptable;
- this.prefHints = prefHints;
-
- this.request = request;
- this.bounds = bounds;
-
- viewDescriptor = new ViewDescriptor(adaptable, prefHints);
-
- // make sure the return object is available even before
- // executing/undoing/redoing
- setResult(CommandResult.newOKCommandResult(viewDescriptor));
-
- }
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- View region = (View)adaptable.getAdapter(View.class);
- // a bunch of initializations
- int direction = request.getResizeDirection();
- int dx = request.getSizeDelta().width;
- int dy = request.getSizeDelta().height;
-
- // depending on the direction of resize there are different
- // scaling/translation to be
- // performed
- // on the nodes sitting on either side of the border which is to be
- // moved
- // the various cases follow the same structure
- // first: retrieve a list of node on a given side of the border
- // second: perform various setting of bounds
- switch(direction) {
- case PositionConstants.WEST:
- // a resize that moves a LEFT border
-
- // retrieve the nodes on the LEFT side of LEFT border
- List<View> todo = Zone.getRegionLeftBorderOutsideNeighbours(region);
- Iterator<View> it = todo.iterator();
- while(it.hasNext()) {
- View view = it.next();
- // for each of these we add (-dx) to their width
- int width = Zone.getWidth(view);
- width -= dx;
- Zone.setWidth(view, width);
- }
- // retrieve the nodes on the RIGHT side of LEFT border
- todo = Zone.getRegionLeftBorderInsideNeighbours(region);
- it = todo.iterator();
- while(it.hasNext()) {
- View view = it.next();
- // for each of these we add dx to their width and translate
- // their x of (-dx)
- int width = Zone.getWidth(view);
- width += dx;
- Zone.setWidth(view, width);
- int x = Zone.getX(view);
- x -= dx;
- Zone.setX(view, x);
- }
- break;
- case PositionConstants.EAST:
- // a resize that moves a RIGHT border
-
- // retrieve the nodes on the LEFT side of RIGHT border
- todo = Zone.getRegionRightBorderInsideNeighbours(region);
- it = todo.iterator();
- while(it.hasNext()) {
- View view = it.next();
- // for each of these we add dx to their width
- int width = Zone.getWidth(view);
- width += dx;
- Zone.setWidth(view, width);
- }
- // retrieve the nodes on the RIGHT side of RIGHT border
- todo = Zone.getRegionRightBorderOutsideNeighbours(region);
- it = todo.iterator();
- while(it.hasNext()) {
- View view = it.next();
- // for each of these we add (-dx) to their width and translate
- // their x of dx
- int width = Zone.getWidth(view);
- width -= dx;
- Zone.setWidth(view, width);
- int x = Zone.getX(view);
- x += dx;
- Zone.setX(view, x);
- }
- break;
- case PositionConstants.NORTH:
- // a resize that moves a TOP border
-
- // retrieve the nodes on the BOTTOM side of TOP border
- todo = Zone.getRegionTopBorderInsideNeighbours(region);
- it = todo.iterator();
- while(it.hasNext()) {
- View view = it.next();
- // for each of these we add dy to their height and (-dy) to
- // their y
- int height = Zone.getHeight(view);
- height += dy;
- Zone.setHeight(view, height);
- int y = Zone.getY(view);
- y -= dy;
- Zone.setY(view, y);
- }
- // retrieve the nodes on the TOP side of TOP border
- todo = Zone.getRegionTopBorderOutsideNeighbours(region);
- it = todo.iterator();
- while(it.hasNext()) {
- View view = it.next();
- // for each of these we add (-dy) to their height
- int height = Zone.getHeight(view);
- height -= dy;
- Zone.setHeight(view, height);
- }
- break;
- case PositionConstants.SOUTH:
- // a resize that moves a BOTTOM border
-
- // retrieve the nodes on the TOP side of BOTTOM border
- todo = Zone.getRegionBottomBorderInsideNeighbours(region);
- it = todo.iterator();
- while(it.hasNext()) {
- View view = it.next();
- // for each of these we add dy to their height
- int height = Zone.getHeight(view);
- height += dy;
- Zone.setHeight(view, height);
- }
- // retrieve the nodes on the BOTTOM side of BOTTOM border
- todo = Zone.getRegionBottomBorderOutsideNeighbours(region);
- it = todo.iterator();
- while(it.hasNext()) {
- View view = it.next();
- // for each of these we add (-dy) to their height and dy to
- // their y
- int height = Zone.getHeight(view);
- height -= dy;
- Zone.setHeight(view, height);
- int y = Zone.getY(view);
- y += dy;
- Zone.setY(view, y);
- }
- break;
- }// switch
- return CommandResult.newOKCommandResult();
- }
-
- public void reverseRequest() {
- request.getMoveDelta().negate();
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomStateMachineResizeCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomStateMachineResizeCommand.java
deleted file mode 100644
index 8df97583be4..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomStateMachineResizeCommand.java
+++ /dev/null
@@ -1,346 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.commands;
-
-import java.util.Iterator;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone;
-
-public class CustomStateMachineResizeCommand extends AbstractTransactionalCommand {
-
- CreateViewRequest.ViewDescriptor viewDescriptor;
-
- IAdaptable adaptable;
-
- PreferencesHint prefHints;
-
- /**
- * The request to perform.
- */
- private ChangeBoundsRequest request = null;
-
- /**
- * The bounds rectangle.
- */
- private Rectangle bounds = null;
-
- private boolean internalResize = false;
-
- public CustomStateMachineResizeCommand(IAdaptable adaptable, PreferencesHint prefHints, TransactionalEditingDomain domain, String label, ChangeBoundsRequest request, Rectangle bounds, boolean internalResize) {
- super(domain, label, null);
-
- this.adaptable = adaptable;
- this.prefHints = prefHints;
-
- this.request = request;
- this.bounds = bounds;
-
- this.internalResize = internalResize;
-
- viewDescriptor = new ViewDescriptor(adaptable, prefHints);
-
- // make sure the return object is available even before
- // executing/undoing/redoing
- setResult(CommandResult.newOKCommandResult(viewDescriptor));
-
- }
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- View stateMachine = (View)adaptable.getAdapter(View.class);
- View stateMachineLabel = (View)stateMachine.getChildren().get(0);
- View stateMachineCompartment = (View)stateMachine.getChildren().get(1);
- // a bunch of initializations
- int direction = request.getResizeDirection();
- int dx = request.getSizeDelta().width;
- int dy = request.getSizeDelta().height;
- int newX = bounds.x;
- int newY = bounds.y;
-
- if(internalResize) {
- Zone.setHeight(stateMachineLabel, Zone.getHeight(stateMachineLabel) + dy);
- // dy = 0;
- }
- // first resize the state machine node with the constraint provided
- Zone.setX(stateMachine, newX);
- Zone.setY(stateMachine, newY);
- Zone.setWidth(stateMachine, Zone.getWidth(stateMachine) + dx);
- Zone.setHeight(stateMachine, Zone.getHeight(stateMachine) + dy);
-
- // resize label and compartment
- Zone.setWidth(stateMachineLabel, Zone.getWidth(stateMachine));
- Zone.setWidth(stateMachineCompartment, Zone.getWidth(stateMachine));
- Zone.setHeight(stateMachineCompartment, Zone.getHeight(stateMachine) - Zone.getHeight(stateMachineLabel));
- Zone.setY(stateMachineCompartment, Zone.getHeight(stateMachineLabel));
-
- if(internalResize && (dx == 0))
- return CommandResult.newOKCommandResult();
-
- // one region displayed case
- if(stateMachineCompartment.getChildren().size() == 1) {
- // we need to resize the region
- View defaultRegion = (View)stateMachineCompartment.getChildren().get(0);
- Zone.setWidth(defaultRegion, Zone.getWidth(stateMachineCompartment));
- Zone.setHeight(defaultRegion, Zone.getHeight(stateMachineCompartment));
- return CommandResult.newOKCommandResult();
-
- }
-
- // multiple region case
-
- // test the direction of resize
- // the processing depends on the direction
- // basically embedded nodes to be either scaled and/or translated along
- // one or two axis
- // depending on their relative positions to the borders of the state
- // machine
- Iterator it = stateMachineCompartment.getChildren().iterator();
- while(it.hasNext()) {
- View view = (View)it.next();
- String zone = Zone.getZone(view);
- switch(direction) {
- case PositionConstants.WEST:
- // we test whether the current node is close to the outer LEFT
- // border
- // this is the case if it has no LEFT neighbors at all
- if(!Zone.hasLeftNeighbours(zone)) {
- // these nodes need to be scaled
- // we add dx to their width
- int width = Zone.getWidth(view);
- width += dx;
- Zone.setWidth(view, width);
- } else {
- // in other cases the node needs to be translated
- // for each of these we translate their x of dx
- int x = Zone.getX(view);
- x += dx;
- Zone.setX(view, x);
- }
- break;
- case PositionConstants.EAST:
- // we test whether the current node is close to the outer RIGHT
- // border
- // this is the case if it has no RIGHT neighbours at all
- if(!Zone.hasRightNeighbours(zone)) {
- // these nodes need to be scaled
- // we add dx to their width
- int width = Zone.getWidth(view);
- width += dx;
- Zone.setWidth(view, width);
- }
- break;
- case PositionConstants.NORTH:
- // we test whether the current node is close to the outer TOP
- // border
- // this is the case if it has no TOP neighbours at all
- if(!Zone.hasTopNeighbours(zone)) {
- // these nodes need to be scaled
- // we add dy to their height
- int height = Zone.getHeight(view);
- height += dy;
- Zone.setHeight(view, height);
- } else {
- // in other cases the node needs to be translated
- // for each of these we translate their y of dy
- int y = Zone.getY(view);
- y += dy;
- Zone.setY(view, y);
- }
- break;
- case PositionConstants.SOUTH:
- // we test whether the current node is close to the outer BOTTOM
- // border
- // this is the case if it has no BOTTOM neighbours at all
- if(!Zone.hasBottomNeighbours(zone)) {
- // these nodes need to be scaled
- // we add dy to their height
- int height = Zone.getHeight(view);
- height += dy;
- Zone.setHeight(view, height);
- }
- break;
- case PositionConstants.NORTH_WEST:
- // we test whether the current node is close to the outer TOP
- // and LEFT borders
- // this is the case if it has no LEFT neighbours nor TOP
- // neighbours at all
- if(!Zone.hasLeftNeighbours(zone) && !Zone.hasTopNeighbours(zone)) {
- // for each of these we add dx to their width and dy to
- // their height
- int width = Zone.getWidth(view);
- width += dx;
- Zone.setWidth(view, width);
- int height = Zone.getHeight(view);
- height += dy;
- Zone.setHeight(view, height);
- }
- // the second case is when it has no LEFT neighbours but TOP
- // ones, i.e. close to
- // LEFT border only
- else if(!Zone.hasLeftNeighbours(zone) && Zone.hasTopNeighbours(zone)) {
- // for each of these we add dx to their width and translate
- // their y of dy
- int width = Zone.getWidth(view);
- width += dx;
- Zone.setWidth(view, width);
- int y = Zone.getY(view);
- y += dy;
- Zone.setY(view, y);
- }
- // in the reverse case, i.e. close to TOP border only
- else if(Zone.hasLeftNeighbours(zone) && !Zone.hasTopNeighbours(zone)) {
- // for each of these we add dy to their height and translate
- // their x of dx
- int height = Zone.getHeight(view);
- height += dy;
- Zone.setHeight(view, height);
- int x = Zone.getX(view);
- x += dx;
- Zone.setX(view, x);
- } else {
- // in other cases the node needs to be translated both ways
- // for each of these we translate their x of dx and their y
- // of dy
- int x = Zone.getX(view);
- x += dx;
- Zone.setX(view, x);
- int y = Zone.getY(view);
- y += dy;
- Zone.setY(view, y);
- }
- break;
- case PositionConstants.NORTH_EAST:
- // we test whether the current node is close to the outer TOP
- // and RIGHT borders
- // this is the case if it has no RIGHT neighbours nor TOP
- // neigbours at all
- if(!Zone.hasRightNeighbours(zone) && !Zone.hasTopNeighbours(zone)) {
- // for each of these we add dx to their width and dy to
- // their height
- int width = Zone.getWidth(view);
- width += dx;
- Zone.setWidth(view, width);
- int height = Zone.getHeight(view);
- height += dy;
- Zone.setHeight(view, height);
- }
- // the second case is when it has no RIGHT neighbours but TOP
- // ones, i.e. close
- // to RIGHT border only
- else if(!Zone.hasRightNeighbours(zone) && Zone.hasTopNeighbours(zone)) {
- // for each of these we add dx to their width and translate
- // their y of dy
- int width = Zone.getWidth(view);
- width += dx;
- Zone.setWidth(view, width);
- int y = Zone.getY(view);
- y += dy;
- Zone.setY(view, y);
- }
- // in the reverse case, i.e. close to TOP border only
- else if(Zone.hasRightNeighbours(zone) && !Zone.hasTopNeighbours(zone)) {
- // for each of these we add dy to their height
- int height = Zone.getHeight(view);
- height += dy;
- Zone.setHeight(view, height);
- } else {
- // in other cases the node needs to be translated along Y
- // for each of these we translate their y of dy
- int y = Zone.getY(view);
- y += dy;
- Zone.setY(view, y);
- }
- break;
- case PositionConstants.SOUTH_WEST:
- // we test whether the current node is close to the outer BOTTOM
- // and LEFT
- // borders
- // this is the case if it has no LEFT neighbours nor BOTTOM
- // neigbours at all
- if(!Zone.hasLeftNeighbours(zone) && !Zone.hasBottomNeighbours(zone)) {
- // for each of these we add dx to their width and dy to
- // their height
- int width = Zone.getWidth(view);
- width += dx;
- Zone.setWidth(view, width);
- int height = Zone.getHeight(view);
- height += dy;
- Zone.setHeight(view, height);
- }
- // the second case is when it has no LEFT neighbours but BOTTOM
- // ones, i.e. close
- // to LEFT border only
- else if(!Zone.hasLeftNeighbours(zone) && Zone.hasBottomNeighbours(zone)) {
- // for each of these we add dx to their width
- int width = Zone.getWidth(view);
- width += dx;
- Zone.setWidth(view, width);
- }
- // in the reverse case, i.e. close to BOTTOM border only
- else if(Zone.hasLeftNeighbours(zone) && !Zone.hasBottomNeighbours(zone)) {
- // for each of these we add dy to their height and translate
- // their x of dx
- int height = Zone.getHeight(view);
- height += dy;
- Zone.setHeight(view, height);
- int x = Zone.getX(view);
- x += dx;
- Zone.setX(view, x);
- } else {
- // in other cases the node needs to be translated in X
- // for each of these we translate their x of dx
- int x = Zone.getX(view);
- x += dx;
- Zone.setX(view, x);
- }
- break;
- case PositionConstants.SOUTH_EAST:
- // we test whether the current node is close to the outer BOTTOM
- // and RIGHT
- // borders
- // this is the case if it has no RIGHT neighbours nor BOTTOM
- // neigbours at all
- if(!Zone.hasRightNeighbours(zone) && !Zone.hasBottomNeighbours(zone)) {
- // for each of these we add dx to their width and dy to
- // their height
- int width = Zone.getWidth(view);
- width += dx;
- Zone.setWidth(view, width);
- int height = Zone.getHeight(view);
- height += dy;
- Zone.setHeight(view, height);
- }
- // the second case is when it has no RIGHT neighbours but BOTTOM
- // ones, i.e.
- // close to RIGHT border only
- else if(!Zone.hasRightNeighbours(zone) && Zone.hasBottomNeighbours(zone)) {
- // for each of these we add dx to their width
- int width = Zone.getWidth(view);
- width += dx;
- Zone.setWidth(view, width);
- }
- // in the reverse case, i.e. close to BOTTOM border only
- else if(Zone.hasRightNeighbours(zone) && !Zone.hasBottomNeighbours(zone)) {
- // for each of these we add dy to their height
- int height = Zone.getHeight(view);
- height += dy;
- Zone.setHeight(view, height);
- }
- break;
- }// switch
- }// while
- return CommandResult.newOKCommandResult();
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomStateMachineSetBoundsCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomStateMachineSetBoundsCommand.java
deleted file mode 100644
index f26109ef02c..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomStateMachineSetBoundsCommand.java
+++ /dev/null
@@ -1,123 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.commands;
-
-import java.util.Iterator;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-
-public class CustomStateMachineSetBoundsCommand extends AbstractTransactionalCommand {
-
- CreateViewRequest.ViewDescriptor viewDescriptor;
-
- Rectangle rect;
-
- Point location;
-
- Dimension size;
-
- public CustomStateMachineSetBoundsCommand(TransactionalEditingDomain domain, String label, CreateViewRequest.ViewDescriptor viewDescriptor, Rectangle rect) {
- super(domain, label, null);
-
- this.viewDescriptor = viewDescriptor;
-
- this.rect = rect;
- location = rect.getLocation();
- size = rect.getSize();
-
- // make sure the return object is available even before
- // executing/undoing/redoing
- setResult(CommandResult.newOKCommandResult(viewDescriptor));
- }
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- View stateMachineView = (View)viewDescriptor.getAdapter(View.class);
- if(location != null) {
- Zone.setX(stateMachineView, location.x);
- Zone.setY(stateMachineView, location.y);
- }
- if((size != null) && !size.equals(-1, -1)) {
- Zone.setWidth(stateMachineView, size.width);
- Zone.setHeight(stateMachineView, size.height);
- } else {
- Zone.setWidth(stateMachineView, Zone.defaultWidth);
- Zone.setHeight(stateMachineView, Zone.defaultHeight);
- }
-
- Iterator<Node> it = stateMachineView.getChildren().iterator();
-
- while(it.hasNext()) {
- Node currentNode = it.next();
- if(currentNode.getLayoutConstraint() == null) {
- currentNode.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- }
- if(UMLVisualIDRegistry.getVisualID(currentNode.getType()) == StateMachineNameEditPart.VISUAL_ID) {
- if((size != null) && !size.equals(-1, -1)) {
- Zone.setWidth(currentNode, size.width);
- Zone.setHeight(currentNode, Zone.defaultHeader);
- } else {
- Zone.setWidth(currentNode, Zone.defaultWidth);
- Zone.setHeight(currentNode, Zone.defaultHeader);
- }
- } else if(UMLVisualIDRegistry.getVisualID(currentNode.getType()) == StateMachineCompartmentEditPart.VISUAL_ID) {
- Zone.setY(currentNode, Zone.defaultHeader);
- if((size != null) && !size.equals(-1, -1)) {
- Zone.setWidth(currentNode, size.width);
- Zone.setHeight(currentNode, size.height - Zone.defaultHeader);
- } else {
- Zone.setWidth(currentNode, Zone.defaultWidth);
- Zone.setHeight(currentNode, Zone.defaultHeight - Zone.defaultHeader);
- }
- int nRegions = currentNode.getChildren().size();
- String prefix = "";
- String zone = "";
- int i = 0;
- int width = 0;
- Iterator<Node> subit = currentNode.getChildren().iterator();
- while(subit.hasNext()) {
- Node subCurrentNode = subit.next();
- if(subCurrentNode.getLayoutConstraint() == null) {
- subCurrentNode.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- }
- if(UMLVisualIDRegistry.getVisualID(subCurrentNode.getType()) == RegionEditPart.VISUAL_ID) {
- if((size != null) && !size.equals(-1, -1)) {
- Zone.setWidth(subCurrentNode, (i == nRegions - 1) ? size.width - width : size.width / nRegions);
- Zone.setHeight(subCurrentNode, size.height - Zone.defaultHeader);
- Zone.setX(subCurrentNode, width);
- width += size.width / nRegions;
- } else {
- Zone.setWidth(subCurrentNode, (i == nRegions - 1) ? Zone.defaultWidth - width : Zone.defaultWidth / nRegions);
- Zone.setHeight(subCurrentNode, Zone.defaultHeight - Zone.defaultHeader);
- Zone.setX(subCurrentNode, width);
- width += Zone.defaultWidth / nRegions;
- }
- zone = (i == nRegions - 1) ? prefix : prefix + Zone.LEFT;
- Zone.setZone(subCurrentNode, zone);
- prefix = prefix + Zone.RIGHT;
- i++;
- }
- }
-
- }
- }
-
- return CommandResult.newOKCommandResult();
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomStateMachineWithDefaultRegionCreateNodeCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomStateMachineWithDefaultRegionCreateNodeCommand.java
deleted file mode 100644
index cfdfc785c2f..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomStateMachineWithDefaultRegionCreateNodeCommand.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.commands;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.commands.SemanticAdapter;
-import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.uml2.uml.Region;
-import org.eclipse.uml2.uml.StateMachine;
-
-public class CustomStateMachineWithDefaultRegionCreateNodeCommand extends AbstractTransactionalCommand {
-
- IAdaptable adaptable;
-
- PreferencesHint prefHints;
-
- CreateViewRequest.ViewDescriptor viewDescriptor;
-
- public CustomStateMachineWithDefaultRegionCreateNodeCommand(IAdaptable adaptable, PreferencesHint prefHints, TransactionalEditingDomain domain, String label, List affectedFiles) {
- super(domain, label, affectedFiles);
- this.adaptable = adaptable;
- this.prefHints = prefHints;
-
- viewDescriptor = new ViewDescriptor(adaptable, prefHints);
-
- // make sure the return object is available even before
- // executing/undoing/redoing
- setResult(CommandResult.newOKCommandResult(viewDescriptor));
- }
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- // adapt the view at execution time
- View stateMachineView = (View)adaptable.getAdapter(View.class);
-
- View compartmentView = null;
-
- Iterator<View> it = stateMachineView.getChildren().iterator();
- while((compartmentView == null) && it.hasNext()) {
- View currentView = (View)it.next();
- if(UMLVisualIDRegistry.getVisualID(currentView.getType()) == StateMachineCompartmentEditPart.VISUAL_ID)
- compartmentView = currentView;
- }
-
- StateMachine stateMachine = (StateMachine)stateMachineView.getElement();
-
- Iterator<Region> regions = stateMachine.getRegions().iterator();
- while(regions.hasNext()) {
- Region region = regions.next();
-
- IAdaptable regionAdaptable = new SemanticAdapter(region, null);
- String semanticHint = ((IHintedType)UMLElementTypes.Region_3000).getSemanticHint();
-
- if(compartmentView != null) {
- Node regionNode = ViewService.getInstance().createNode(regionAdaptable, compartmentView, semanticHint, -1, prefHints);
-
- // add region specifics
- Zone.createRegionDefaultAnnotation(regionNode);
-
- if(regionNode != null) {
- viewDescriptor.setView(regionNode);
- }
-
- }
- }
- return CommandResult.newOKCommandResult(viewDescriptor);
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomStateResizeCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomStateResizeCommand.java
deleted file mode 100644
index f63aa05c6c8..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomStateResizeCommand.java
+++ /dev/null
@@ -1,352 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.commands;
-
-import java.util.Iterator;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone;
-
-public class CustomStateResizeCommand extends AbstractTransactionalCommand {
-
- CreateViewRequest.ViewDescriptor viewDescriptor;
-
- IAdaptable adaptable;
-
- PreferencesHint prefHints;
-
- /**
- * The request to perform.
- */
- private ChangeBoundsRequest request = null;
-
- /**
- * The bounds rectangle.
- */
- private Rectangle bounds = null;
-
- private boolean internalResize = false;
-
- public CustomStateResizeCommand(IAdaptable adaptable, PreferencesHint prefHints, TransactionalEditingDomain domain, String label, ChangeBoundsRequest request, Rectangle bounds, boolean internalResize) {
- super(domain, label, null);
-
- this.adaptable = adaptable;
- this.prefHints = prefHints;
-
- this.request = request;
- this.bounds = bounds;
-
- this.internalResize = internalResize;
-
- viewDescriptor = new ViewDescriptor(adaptable, prefHints);
-
- // make sure the return object is available even before
- // executing/undoing/redoing
- setResult(CommandResult.newOKCommandResult(viewDescriptor));
-
- }
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- View state = (View)adaptable.getAdapter(View.class);
- View stateLabel = (View)state.getChildren().get(0);
- View stateCompartment = (View)state.getChildren().get(1);
-
- // a bunch of initializations
- int direction = request.getResizeDirection();
- int dx = request.getSizeDelta().width;
- int dy = request.getSizeDelta().height;
-
- Iterator<Node> it = state.getChildren().iterator();
-
- while(it.hasNext()) {
- Node currentNode = it.next();
- if(currentNode.getLayoutConstraint() == null) {
- currentNode.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- }
- }
-
- if(internalResize) {
- Zone.setHeight(stateLabel, Zone.getHeight(stateLabel) + dy);
- // dy = 0;
- }
- // first resize the state node with the constraint provided
- Zone.setBounds(state, bounds);
- // resize label and compartment
- Zone.setWidth(stateLabel, bounds.width);
- Zone.setWidth(stateCompartment, bounds.width);
- Zone.setHeight(stateCompartment, bounds.height - Zone.getHeight(stateLabel));
- Zone.setY(stateCompartment, Zone.getHeight(stateLabel));
-
- if(internalResize && (dx == 0))
- return CommandResult.newOKCommandResult();
-
- // one region displayed case
- if(stateCompartment.getChildren().size() == 1) {
- // we need to resize the region
- View defaultRegion = (View)stateCompartment.getChildren().get(0);
- Zone.setWidth(defaultRegion, Zone.getWidth(stateCompartment));
- Zone.setHeight(defaultRegion, Zone.getHeight(stateCompartment));
- return CommandResult.newOKCommandResult();
-
- }
-
- // multiple region case
-
- // test the direction of resize
- // the processing depends on the direction
- // basically embedded nodes to be either scaled and/or translated along
- // one or two axis
- // depending on their relative positions to the borders of the state
- // machine
- it = stateCompartment.getChildren().iterator();
- while(it.hasNext()) {
- View view = (View)it.next();
- String zone = Zone.getZone(view);
- switch(direction) {
- case PositionConstants.WEST:
- // we test whether the current node is close to the outer LEFT
- // border
- // this is the case if it has no LEFT neighbors at all
- if(!Zone.hasLeftNeighbours(zone)) {
- // these nodes need to be scaled
- // we add dx to their width
- int width = Zone.getWidth(view);
- width += dx;
- Zone.setWidth(view, width);
- } else {
- // in other cases the node needs to be translated
- // for each of these we translate their x of dx
- int x = Zone.getX(view);
- x += dx;
- Zone.setX(view, x);
- }
- break;
- case PositionConstants.EAST:
- // we test whether the current node is close to the outer RIGHT
- // border
- // this is the case if it has no RIGHT neighbours at all
- if(!Zone.hasRightNeighbours(zone)) {
- // these nodes need to be scaled
- // we add dx to their width
- int width = Zone.getWidth(view);
- width += dx;
- Zone.setWidth(view, width);
- }
- break;
- case PositionConstants.NORTH:
- // we test whether the current node is close to the outer TOP
- // border
- // this is the case if it has no TOP neighbours at all
- if(!Zone.hasTopNeighbours(zone)) {
- // these nodes need to be scaled
- // we add dy to their height
- int height = Zone.getHeight(view);
- height += dy;
- Zone.setHeight(view, height);
- } else {
- // in other cases the node needs to be translated
- // for each of these we translate their y of dy
- int y = Zone.getY(view);
- y += dy;
- Zone.setY(view, y);
- }
- break;
- case PositionConstants.SOUTH:
- // we test whether the current node is close to the outer BOTTOM
- // border
- // this is the case if it has no BOTTOM neighbours at all
- if(!Zone.hasBottomNeighbours(zone)) {
- // these nodes need to be scaled
- // we add dy to their height
- int height = Zone.getHeight(view);
- height += dy;
- Zone.setHeight(view, height);
- }
- break;
- case PositionConstants.NORTH_WEST:
- // we test whether the current node is close to the outer TOP
- // and LEFT borders
- // this is the case if it has no LEFT neighbours nor TOP
- // neighbours at all
- if(!Zone.hasLeftNeighbours(zone) && !Zone.hasTopNeighbours(zone)) {
- // for each of these we add dx to their width and dy to
- // their height
- int width = Zone.getWidth(view);
- width += dx;
- Zone.setWidth(view, width);
- int height = Zone.getHeight(view);
- height += dy;
- Zone.setHeight(view, height);
- }
- // the second case is when it has no LEFT neighbours but TOP
- // ones, i.e. close to
- // LEFT border only
- else if(!Zone.hasLeftNeighbours(zone) && Zone.hasTopNeighbours(zone)) {
- // for each of these we add dx to their width and translate
- // their y of dy
- int width = Zone.getWidth(view);
- width += dx;
- Zone.setWidth(view, width);
- int y = Zone.getY(view);
- y += dy;
- Zone.setY(view, y);
- }
- // in the reverse case, i.e. close to TOP border only
- else if(Zone.hasLeftNeighbours(zone) && !Zone.hasTopNeighbours(zone)) {
- // for each of these we add dy to their height and translate
- // their x of dx
- int height = Zone.getHeight(view);
- height += dy;
- Zone.setHeight(view, height);
- int x = Zone.getX(view);
- x += dx;
- Zone.setX(view, x);
- } else {
- // in other cases the node needs to be translated both ways
- // for each of these we translate their x of dx and their y
- // of dy
- int x = Zone.getX(view);
- x += dx;
- Zone.setX(view, x);
- int y = Zone.getY(view);
- y += dy;
- Zone.setY(view, y);
- }
- break;
- case PositionConstants.NORTH_EAST:
- // we test whether the current node is close to the outer TOP
- // and RIGHT borders
- // this is the case if it has no RIGHT neighbours nor TOP
- // neigbours at all
- if(!Zone.hasRightNeighbours(zone) && !Zone.hasTopNeighbours(zone)) {
- // for each of these we add dx to their width and dy to
- // their height
- int width = Zone.getWidth(view);
- width += dx;
- Zone.setWidth(view, width);
- int height = Zone.getHeight(view);
- height += dy;
- Zone.setHeight(view, height);
- }
- // the second case is when it has no RIGHT neighbours but TOP
- // ones, i.e. close
- // to RIGHT border only
- else if(!Zone.hasRightNeighbours(zone) && Zone.hasTopNeighbours(zone)) {
- // for each of these we add dx to their width and translate
- // their y of dy
- int width = Zone.getWidth(view);
- width += dx;
- Zone.setWidth(view, width);
- int y = Zone.getY(view);
- y += dy;
- Zone.setY(view, y);
- }
- // in the reverse case, i.e. close to TOP border only
- else if(Zone.hasRightNeighbours(zone) && !Zone.hasTopNeighbours(zone)) {
- // for each of these we add dy to their height
- int height = Zone.getHeight(view);
- height += dy;
- Zone.setHeight(view, height);
- } else {
- // in other cases the node needs to be translated along Y
- // for each of these we translate their y of dy
- int y = Zone.getY(view);
- y += dy;
- Zone.setY(view, y);
- }
- break;
- case PositionConstants.SOUTH_WEST:
- // we test whether the current node is close to the outer BOTTOM
- // and LEFT
- // borders
- // this is the case if it has no LEFT neighbours nor BOTTOM
- // neigbours at all
- if(!Zone.hasLeftNeighbours(zone) && !Zone.hasBottomNeighbours(zone)) {
- // for each of these we add dx to their width and dy to
- // their height
- int width = Zone.getWidth(view);
- width += dx;
- Zone.setWidth(view, width);
- int height = Zone.getHeight(view);
- height += dy;
- Zone.setHeight(view, height);
- }
- // the second case is when it has no LEFT neighbours but BOTTOM
- // ones, i.e. close
- // to LEFT border only
- else if(!Zone.hasLeftNeighbours(zone) && Zone.hasBottomNeighbours(zone)) {
- // for each of these we add dx to their width
- int width = Zone.getWidth(view);
- width += dx;
- Zone.setWidth(view, width);
- }
- // in the reverse case, i.e. close to BOTTOM border only
- else if(Zone.hasLeftNeighbours(zone) && !Zone.hasBottomNeighbours(zone)) {
- // for each of these we add dy to their height and translate
- // their x of dx
- int height = Zone.getHeight(view);
- height += dy;
- Zone.setHeight(view, height);
- int x = Zone.getX(view);
- x += dx;
- Zone.setX(view, x);
- } else {
- // in other cases the node needs to be translated in X
- // for each of these we translate their x of dx
- int x = Zone.getX(view);
- x += dx;
- Zone.setX(view, x);
- }
- break;
- case PositionConstants.SOUTH_EAST:
- // we test whether the current node is close to the outer BOTTOM
- // and RIGHT
- // borders
- // this is the case if it has no RIGHT neighbours nor BOTTOM
- // neigbours at all
- if(!Zone.hasRightNeighbours(zone) && !Zone.hasBottomNeighbours(zone)) {
- // for each of these we add dx to their width and dy to
- // their height
- int width = Zone.getWidth(view);
- width += dx;
- Zone.setWidth(view, width);
- int height = Zone.getHeight(view);
- height += dy;
- Zone.setHeight(view, height);
- }
- // the second case is when it has no RIGHT neighbours but BOTTOM
- // ones, i.e.
- // close to RIGHT border only
- else if(!Zone.hasRightNeighbours(zone) && Zone.hasBottomNeighbours(zone)) {
- // for each of these we add dx to their width
- int width = Zone.getWidth(view);
- width += dx;
- Zone.setWidth(view, width);
- }
- // in the reverse case, i.e. close to BOTTOM border only
- else if(Zone.hasRightNeighbours(zone) && !Zone.hasBottomNeighbours(zone)) {
- // for each of these we add dy to their height
- int height = Zone.getHeight(view);
- height += dy;
- Zone.setHeight(view, height);
- }
- break;
- }// switch
- }// while
- return CommandResult.newOKCommandResult();
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomVertexCreateElementCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomVertexCreateElementCommand.java
deleted file mode 100644
index c4508a173b8..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/commands/CustomVertexCreateElementCommand.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.commands.SemanticAdapter;
-import org.eclipse.papyrus.diagram.statemachine.providers.ElementInitializers;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.uml2.uml.FinalState;
-import org.eclipse.uml2.uml.Pseudostate;
-import org.eclipse.uml2.uml.Region;
-import org.eclipse.uml2.uml.State;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.Vertex;
-
-public class CustomVertexCreateElementCommand extends AbstractTransactionalCommand {
-
- IAdaptable adaptable;
-
- PreferencesHint prefHints;
-
- IHintedType hint;
-
- CreateViewRequest.ViewDescriptor viewDescriptor;
-
- CreateElementRequest createElementRequest;
-
- public CustomVertexCreateElementCommand(IAdaptable adaptable, IHintedType hint, PreferencesHint prefHints, TransactionalEditingDomain domain, String label) {
- super(domain, label, null);
- this.adaptable = adaptable;
- this.hint = hint;
- this.prefHints = prefHints;
-
- viewDescriptor = new ViewDescriptor(adaptable, prefHints);
-
- // make sure the return object is available even before
- // executing/undoing/redoing
- setResult(CommandResult.newOKCommandResult(viewDescriptor));
-
- }
-
- protected void doConfigure(Vertex newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = createElementRequest.getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(createElementRequest.getClientContext());
- configureRequest.addParameters(createElementRequest.getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if(configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- // adapt the view at execution time
- View regionView = (View)adaptable.getAdapter(View.class);
- View compartment = (View)regionView.getChildren().get(0);
-
- Region owner = (Region)regionView.getElement();
- Vertex newVertex = null;
- if(hint.getSemanticHint().equals(((IHintedType)UMLElementTypes.FinalState_5000).getSemanticHint())) {
- newVertex = UMLFactory.eINSTANCE.createFinalState();
- owner.getSubvertices().add(newVertex);
- ElementInitializers.getInstance().init_FinalState_5000((FinalState)newVertex);
- createElementRequest = new CreateElementRequest(getEditingDomain(), regionView, UMLElementTypes.FinalState_5000);
- } else if(hint.getSemanticHint().equals(((IHintedType)UMLElementTypes.State_6000).getSemanticHint())) {
- newVertex = UMLFactory.eINSTANCE.createState();
- owner.getSubvertices().add(newVertex);
- ElementInitializers.getInstance().init_State_6000((State)newVertex);
- createElementRequest = new CreateElementRequest(getEditingDomain(), regionView, UMLElementTypes.State_6000);
- } else {
- newVertex = UMLFactory.eINSTANCE.createPseudostate();
- if(hint.getSemanticHint().equals(((IHintedType)UMLElementTypes.Pseudostate_8000).getSemanticHint())) {
- owner.getSubvertices().add(newVertex);
- ElementInitializers.getInstance().init_Pseudostate_8000((Pseudostate)newVertex);
- createElementRequest = new CreateElementRequest(getEditingDomain(), regionView, UMLElementTypes.Pseudostate_8000);
- } else if(hint.getSemanticHint().equals(((IHintedType)UMLElementTypes.Pseudostate_9000).getSemanticHint())) {
- owner.getSubvertices().add(newVertex);
- ElementInitializers.getInstance().init_Pseudostate_9000((Pseudostate)newVertex);
- createElementRequest = new CreateElementRequest(getEditingDomain(), regionView, UMLElementTypes.Pseudostate_9000);
- } else if(hint.getSemanticHint().equals(((IHintedType)UMLElementTypes.Pseudostate_10000).getSemanticHint())) {
- owner.getSubvertices().add(newVertex);
- ElementInitializers.getInstance().init_Pseudostate_10000((Pseudostate)newVertex);
- createElementRequest = new CreateElementRequest(getEditingDomain(), regionView, UMLElementTypes.Pseudostate_10000);
- } else if(hint.getSemanticHint().equals(((IHintedType)UMLElementTypes.Pseudostate_11000).getSemanticHint())) {
- owner.getSubvertices().add(newVertex);
- ElementInitializers.getInstance().init_Pseudostate_11000((Pseudostate)newVertex);
- createElementRequest = new CreateElementRequest(getEditingDomain(), regionView, UMLElementTypes.Pseudostate_11000);
- } else if(hint.getSemanticHint().equals(((IHintedType)UMLElementTypes.Pseudostate_12000).getSemanticHint())) {
- owner.getSubvertices().add(newVertex);
- ElementInitializers.getInstance().init_Pseudostate_12000((Pseudostate)newVertex);
- createElementRequest = new CreateElementRequest(getEditingDomain(), regionView, UMLElementTypes.Pseudostate_12000);
- } else if(hint.getSemanticHint().equals(((IHintedType)UMLElementTypes.Pseudostate_13000).getSemanticHint())) {
- owner.getSubvertices().add(newVertex);
- ElementInitializers.getInstance().init_Pseudostate_13000((Pseudostate)newVertex);
- createElementRequest = new CreateElementRequest(getEditingDomain(), regionView, UMLElementTypes.Pseudostate_13000);
- } else if(hint.getSemanticHint().equals(((IHintedType)UMLElementTypes.Pseudostate_14000).getSemanticHint())) {
- owner.getSubvertices().add(newVertex);
- ElementInitializers.getInstance().init_Pseudostate_14000((Pseudostate)newVertex);
- createElementRequest = new CreateElementRequest(getEditingDomain(), regionView, UMLElementTypes.Pseudostate_14000);
- } else if(hint.getSemanticHint().equals(((IHintedType)UMLElementTypes.Pseudostate_15000).getSemanticHint())) {
- owner.getSubvertices().add(newVertex);
- ElementInitializers.getInstance().init_Pseudostate_15000((Pseudostate)newVertex);
- createElementRequest = new CreateElementRequest(getEditingDomain(), regionView, UMLElementTypes.Pseudostate_15000);
- } else if(hint.getSemanticHint().equals(((IHintedType)UMLElementTypes.Pseudostate_16000).getSemanticHint())) {
- ((State)owner.eContainer()).getConnectionPoints().add((Pseudostate)newVertex);
- ElementInitializers.getInstance().init_Pseudostate_16000((Pseudostate)newVertex);
- createElementRequest = new CreateElementRequest(getEditingDomain(), regionView, UMLElementTypes.Pseudostate_16000);
- } else if(hint.getSemanticHint().equals(((IHintedType)UMLElementTypes.Pseudostate_17000).getSemanticHint())) {
- ((State)owner.eContainer()).getConnectionPoints().add((Pseudostate)newVertex);
- ElementInitializers.getInstance().init_Pseudostate_17000((Pseudostate)newVertex);
- createElementRequest = new CreateElementRequest(getEditingDomain(), regionView, UMLElementTypes.Pseudostate_17000);
- }
- }
-
- doConfigure(newVertex, monitor, info);
-
- // create a view for the new vertex on the regionCompartment
- IAdaptable newVertexAdapatable = new SemanticAdapter(newVertex, null);
-
- View newVertexView;
-
- if(hint.getSemanticHint().equals(((IHintedType)UMLElementTypes.Pseudostate_16000).getSemanticHint()) || hint.getSemanticHint().equals(((IHintedType)UMLElementTypes.Pseudostate_17000).getSemanticHint())) {
- newVertexView = (View)ViewService.getInstance().createNode(newVertexAdapatable, (View)regionView.eContainer().eContainer(), hint.getSemanticHint(), -1, prefHints);
- } else {
- newVertexView = (View)ViewService.getInstance().createNode(newVertexAdapatable, compartment, hint.getSemanticHint(), -1, prefHints);
-
- }
- viewDescriptor.setView(newVertexView);
-
- return CommandResult.newOKCommandResult(viewDescriptor);
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomConnectionPointReferenceNameEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomConnectionPointReferenceNameEditPart.java
deleted file mode 100644
index deb65fa55c1..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomConnectionPointReferenceNameEditPart.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.edit.part;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.ConnectionPointReferenceFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.ConnectionPointReferenceEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.ConnectionPointReferenceNameEditPart;
-import org.eclipse.uml2.uml.ConnectionPointReference;
-import org.eclipse.uml2.uml.Pseudostate;
-
-
-public class CustomConnectionPointReferenceNameEditPart extends ConnectionPointReferenceNameEditPart {
-
- public CustomConnectionPointReferenceNameEditPart(View view) {
- super(view);
- }
-
- @Override
- protected void handleNotificationEvent(Notification event) {
- // TODO Auto-generated method stub
- super.handleNotificationEvent(event);
-
- refreshVisuals();
- }
-
- public String getLinks(ConnectionPointReference ref) {
- String label = "";
- if(!ref.getEntries().isEmpty()) {
- boolean first = true;
- for(Pseudostate p : ref.getEntries()) {
- if(!first) {
- label += ", ";
- } else {
- first = false;
- }
- label += p.getName();
- }
- } else if(!ref.getExits().isEmpty()) {
- boolean first = true;
- for(Pseudostate p : ref.getExits()) {
- if(!first) {
- label += ", ";
- } else {
- first = false;
- }
- label += p.getName();
- }
- }
- return label;
- }
-
- @Override
- protected void refreshVisuals() {
- // TODO Auto-generated method stub
- super.refreshVisuals();
-
- ConnectionPointReferenceFigure connPtRefFigure = ((ConnectionPointReferenceEditPart)getParent()).getPrimaryShape();
- ConnectionPointReference connPtRef = (ConnectionPointReference)((View)getModel()).getElement();
-
- if(connPtRef.getEntries().isEmpty() && connPtRef.getExits().isEmpty())
- connPtRefFigure.setKind(0);
- else {
- setLabelText(getLinks(connPtRef));
- if(!connPtRef.getEntries().isEmpty()) {
- connPtRefFigure.setKind(1);
-
- } else if(!connPtRef.getExits().isEmpty()) {
- connPtRefFigure.setKind(2);
- }
- }
-
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomFinalStateEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomFinalStateEditPart.java
deleted file mode 100644
index e835bead979..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomFinalStateEditPart.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.edit.part;
-
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.FinalStateEditPart;
-
-
-public class CustomFinalStateEditPart extends FinalStateEditPart {
-
-
- public CustomFinalStateEditPart(View view) {
- super(view);
- // TODO Auto-generated constructor stub
- }
-
- @Override
- protected void createDefaultEditPolicies() {
- // TODO Auto-generated method stub
- super.createDefaultEditPolicies();
- removeEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE);
- removeEditPolicy(EditPolicyRoles.POPUPBAR_ROLE);
-
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomPackageEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomPackageEditPart.java
deleted file mode 100644
index 11f4cde2a68..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomPackageEditPart.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.edit.part;
-
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PackageEditPart;
-
-public class CustomPackageEditPart extends PackageEditPart {
-
- public CustomPackageEditPart(View view) {
- super(view);
- // TODO Auto-generated constructor stub
- }
-
- @Override
- protected void createDefaultEditPolicies() {
- // TODO Auto-generated method stub
- super.createDefaultEditPolicies();
- removeEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE);
- removeEditPolicy(EditPolicyRoles.POPUPBAR_ROLE);
-
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomRegionCompartmentEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomRegionCompartmentEditPart.java
deleted file mode 100644
index 78f3b8ec742..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomRegionCompartmentEditPart.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.edit.part;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.SelectionRequest;
-import org.eclipse.gef.tools.DeselectAllTracker;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.diagram.ui.internal.tools.RubberbandDragTracker;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.CustomShapeCompartmentFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionCompartmentEditPart;
-import org.eclipse.uml2.uml.Region;
-
-public class CustomRegionCompartmentEditPart extends RegionCompartmentEditPart {
-
- public CustomRegionCompartmentEditPart(View view) {
- super(view);
- // TODO Auto-generated constructor stub
- }
-
- @Override
- protected void createDefaultEditPolicies() {
- // TODO Auto-generated method stub
- super.createDefaultEditPolicies();
- removeEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE);
- removeEditPolicy(EditPolicyRoles.POPUPBAR_ROLE);
-
- }
-
- public IFigure createFigure() {
- CustomShapeCompartmentFigure result = new CustomShapeCompartmentFigure(getCompartmentName(), getMapMode());
- result.setBorder(null);
- return result;
- }
-
- @Override
- public DragTracker getDragTracker(Request req) {
- if(!supportsDragSelection())
- return super.getDragTracker(req);
-
- if(req instanceof SelectionRequest && ((SelectionRequest)req).getLastButtonPressed() == 3)
- return new DeselectAllTracker(this) {
-
- protected boolean handleButtonDown(int button) {
- getCurrentViewer().select(getParent());
- return true;
- }
- };
- return new RubberbandDragTracker() {
-
- protected void handleFinished() {
- if(getViewer().getSelectedEditParts().isEmpty())
- getViewer().select(getParent());
- }
- };
- }
-
- @Override
- protected void refreshVisuals() {
- // TODO Auto-generated method stub
- super.refreshVisuals();
-
- View regionView = (View)((View)getModel()).eContainer();
- Region region = (Region)regionView.getElement();
-
- ((CustomShapeCompartmentFigure)getFigure()).setToolTip(region.getName());
-
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomRegionEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomRegionEditPart.java
deleted file mode 100644
index 46952a7346d..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomRegionEditPart.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.edit.part;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.RegionFigure;
-import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomRegionDragTracker;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomRegionResizableEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-
-public class CustomRegionEditPart extends RegionEditPart {
-
- /** The DragTracker associated to the EditPart. */
- private DragTracker tracker = null;
-
- public CustomRegionEditPart(View view) {
- super(view);
- // TODO Auto-generated constructor stub
- }
-
- @Override
- protected void createDefaultEditPolicies() {
- // TODO Auto-generated method stub
- super.createDefaultEditPolicies();
- removeEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE);
- removeEditPolicy(EditPolicyRoles.POPUPBAR_ROLE);
-
- }
-
- /**
- * This method is overridden to store the DragTracker locally.
- *
- * @param request
- * the associated Request
- *
- * @return the DragTracker created by the superclass
- */
- @Override
- public DragTracker getDragTracker(Request request) {
- tracker = new CustomRegionDragTracker(this);
- return tracker;
- }
-
- /**
- * This method provides access to the RegionDragTracker if any or returns
- * null.
- *
- * @return the RegionDragTracker
- */
- public CustomRegionDragTracker getRegionDragTracker() {
- if((tracker != null) && (tracker instanceof CustomRegionDragTracker))
- return (CustomRegionDragTracker)tracker;
- return null;
- }
-
- @Override
- protected void handleNotificationEvent(Notification notification) {
- super.handleNotificationEvent(notification);
- if(getParent() != null)
- refreshVisuals();
- }
-
- @Override
- protected void refreshVisuals() {
- // TODO Auto-generated method stub
- super.refreshVisuals();
-
- View view = (View)getModel();
- RegionFigure f = getPrimaryShape();
-
- // check the region zone
- String zone = Zone.getZone(view);
- // check the neighbours if any and change the corresponding flags in the
- // figure
- if(Zone.hasRightNeighbours(zone))
- f.setDisplayRightBorder(true);
- else
- f.setDisplayRightBorder(false);
- if(Zone.hasBottomNeighbours(zone))
- f.setDisplayBottomBorder(true);
- else
- f.setDisplayBottomBorder(false);
-
- CustomRegionResizableEditPolicy policy = (CustomRegionResizableEditPolicy)getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- // test for allowed directions
- int dirs = Zone.getAllowedResizeDirections(zone);
- // constrain the edit policy with these directions
- if(policy != null)
- policy.setResizeDirections(dirs);
-
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateCompartmentEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateCompartmentEditPart.java
deleted file mode 100644
index b154c83aea5..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateCompartmentEditPart.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.edit.part;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.CustomShapeCompartmentFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateCompartmentEditPart;
-import org.eclipse.uml2.uml.State;
-
-public class CustomStateCompartmentEditPart extends StateCompartmentEditPart {
-
- public CustomStateCompartmentEditPart(View view) {
- super(view);
- // TODO Auto-generated constructor stub
- }
-
- @Override
- protected void createDefaultEditPolicies() {
- // TODO Auto-generated method stub
- super.createDefaultEditPolicies();
- removeEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE);
- removeEditPolicy(EditPolicyRoles.POPUPBAR_ROLE);
-
- }
-
- public IFigure createFigure() {
- CustomShapeCompartmentFigure result = new CustomShapeCompartmentFigure(getCompartmentName(), getMapMode());
- return result;
- }
-
- @Override
- protected void handleNotificationEvent(Notification notification) {
- // TODO Auto-generated method stub
- super.handleNotificationEvent(notification);
- refreshVisuals();
- }
-
- @Override
- protected void refreshVisuals() {
- // TODO Auto-generated method stub
- super.refreshVisuals();
-
- View stateView = (View)((View)getModel()).eContainer();
- State state = (State)stateView.getElement();
-
- ((CustomShapeCompartmentFigure)getFigure()).setToolTip(state.getName());
-
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateEditPart.java
deleted file mode 100644
index 52599bf8e92..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateEditPart.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.edit.part;
-
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateEditPart;
-
-public class CustomStateEditPart extends StateEditPart {
-
- public CustomStateEditPart(View view) {
- super(view);
- }
-
- @Override
- protected void createDefaultEditPolicies() {
- // TODO Auto-generated method stub
- super.createDefaultEditPolicies();
- removeEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE);
- removeEditPolicy(EditPolicyRoles.POPUPBAR_ROLE);
-
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateMachineCompartmentEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateMachineCompartmentEditPart.java
deleted file mode 100644
index eb0f046acf9..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateMachineCompartmentEditPart.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.edit.part;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.CustomShapeCompartmentFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineCompartmentEditPart;
-import org.eclipse.uml2.uml.StateMachine;
-
-public class CustomStateMachineCompartmentEditPart extends StateMachineCompartmentEditPart {
-
- public CustomStateMachineCompartmentEditPart(View view) {
- super(view);
- // TODO Auto-generated constructor stub
- }
-
- @Override
- protected void createDefaultEditPolicies() {
- // TODO Auto-generated method stub
- super.createDefaultEditPolicies();
- removeEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE);
- removeEditPolicy(EditPolicyRoles.POPUPBAR_ROLE);
-
- }
-
- public IFigure createFigure() {
- CustomShapeCompartmentFigure result = new CustomShapeCompartmentFigure(getCompartmentName(), getMapMode());
- return result;
- }
-
- @Override
- protected void handleNotificationEvent(Notification notification) {
- // TODO Auto-generated method stub
- super.handleNotificationEvent(notification);
- refreshVisuals();
- }
-
- @Override
- protected void refreshVisuals() {
- // TODO Auto-generated method stub
- super.refreshVisuals();
-
- View smView = (View)((View)getModel()).eContainer();
- StateMachine sm = (StateMachine)smView.getElement();
-
- ((CustomShapeCompartmentFigure)getFigure()).setToolTip(sm.getName());
-
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateMachineEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateMachineEditPart.java
deleted file mode 100644
index f68268c7c58..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateMachineEditPart.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.edit.part;
-
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineEditPart;
-
-public class CustomStateMachineEditPart extends StateMachineEditPart {
-
- public CustomStateMachineEditPart(View view) {
- super(view);
- // TODO Auto-generated constructor stub
- }
-
- @Override
- protected void createDefaultEditPolicies() {
- // TODO Auto-generated method stub
- super.createDefaultEditPolicies();
- removeEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE);
- removeEditPolicy(EditPolicyRoles.POPUPBAR_ROLE);
-
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateMachineNameEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateMachineNameEditPart.java
deleted file mode 100644
index a4df5c43277..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateMachineNameEditPart.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.edit.part;
-
-import java.util.Collections;
-import java.util.Iterator;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.transaction.Transaction;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.commands.SemanticAdapter;
-import org.eclipse.papyrus.diagram.common.figure.node.StereotypePropertiesCompartment;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomStateMachineResizeCommand;
-import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineNameEditPart;
-
-public class CustomStateMachineNameEditPart extends StateMachineNameEditPart {
-
- public CustomStateMachineNameEditPart(View view) {
- super(view);
- // TODO Auto-generated constructor stub
- }
-
- @Override
- protected void createDefaultEditPolicies() {
- // TODO Auto-generated method stub
- super.createDefaultEditPolicies();
- removeEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE);
- removeEditPolicy(EditPolicyRoles.POPUPBAR_ROLE);
-
- }
-
- @Override
- protected void handleNotificationEvent(Notification notification) {
- // TODO Auto-generated method stub
- super.handleNotificationEvent(notification);
-
- refreshVisuals();
- }
-
- @Override
- protected void refreshVisuals() {
- // TODO Auto-generated method stub
- super.refreshVisuals();
- int height = 0;
- int width = 0;
- Iterator<IFigure> it = (Iterator<IFigure>)getFigure().getParent().getChildren().iterator();
- while(it.hasNext()) {
- IFigure current = it.next();
- if((current instanceof Label) || (current instanceof WrappingLabel) || (current instanceof StereotypePropertiesCompartment)) {
- Dimension d = current.getPreferredSize().getCopy();
- height += d.height;
- width = Math.max(width, d.width);
- }
- }
-
- View stateMachineLabelView = (View)getModel();
- View stateMachineView = (View)stateMachineLabelView.eContainer();
- View stateMachineCompartView = (View)stateMachineView.getChildren().get(1);
-
- int stateMachineHeight = Zone.getHeight(stateMachineView);
- int stateMachineWidth = Zone.getWidth(stateMachineView);
-
- int stateMachineCompartHeight = Zone.getHeight(stateMachineCompartView);
-
- int dx = width - stateMachineWidth;
- int dy = stateMachineCompartHeight + height - stateMachineHeight;
- int x = Zone.getX(stateMachineView);
- int y = Zone.getY(stateMachineView);
-
- if((stateMachineHeight != -1) && (width != 0) && (dy != 0)) {
- dx = (dx > 0) ? dx : 0;
- // a resize request, which we route to the specific ResizeCommand
- IAdaptable adaptableForStateMachine = new SemanticAdapter(null, stateMachineView);
- ChangeBoundsRequest internalResizeRequest = new ChangeBoundsRequest();
- internalResizeRequest.setResizeDirection(PositionConstants.EAST);
- internalResizeRequest.setSizeDelta(new Dimension(dx, dy));
- Rectangle rect = new Rectangle(x, y, stateMachineWidth + dx, stateMachineHeight + dy);
-
- CustomStateMachineResizeCommand internalResizeCommand = new CustomStateMachineResizeCommand(adaptableForStateMachine, getDiagramPreferencesHint(), getEditingDomain(), DiagramUIMessages.CreateCommand_Label, internalResizeRequest, rect, true);
- internalResizeCommand.setOptions(Collections.singletonMap(Transaction.OPTION_UNPROTECTED, Boolean.TRUE));
- try {
- internalResizeCommand.execute(null, null);
- } catch (ExecutionException e) {
- }
-
- }
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateNameEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateNameEditPart.java
deleted file mode 100644
index 166cc734dff..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateNameEditPart.java
+++ /dev/null
@@ -1,164 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.edit.part;
-
-import java.util.Collections;
-import java.util.Iterator;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.transaction.Transaction;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.commands.SemanticAdapter;
-import org.eclipse.papyrus.diagram.common.figure.node.StereotypePropertiesCompartment;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomStateResizeCommand;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.StateFigure;
-import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateNameEditPart;
-import org.eclipse.uml2.uml.Activity;
-import org.eclipse.uml2.uml.Behavior;
-import org.eclipse.uml2.uml.OpaqueBehavior;
-import org.eclipse.uml2.uml.State;
-import org.eclipse.uml2.uml.StateMachine;
-
-public class CustomStateNameEditPart extends StateNameEditPart {
-
- public CustomStateNameEditPart(View view) {
- super(view);
- // TODO Auto-generated constructor stub
- }
-
- private String behaviorKindAsString(Behavior b) {
- if(b instanceof Activity)
- return "Activity";
- if(b instanceof StateMachine)
- return "StateMachine";
- if(b instanceof OpaqueBehavior)
- return "OpaqueBehavior";
- return "";
- }
-
- @Override
- protected void createDefaultEditPolicies() {
- // TODO Auto-generated method stub
- super.createDefaultEditPolicies();
- removeEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE);
- removeEditPolicy(EditPolicyRoles.POPUPBAR_ROLE);
-
- }
-
- public String getInformationFromState(State state) {
- String textToEdit = "";
-
- // entryActivity
- if(state.getEntry() != null) {
- String kind = behaviorKindAsString(state.getEntry());
- textToEdit = "/entry " + kind + " " + state.getEntry().getName();
- }
-
- // doActivity
- if(state.getDoActivity() != null) {
- String kind = behaviorKindAsString(state.getDoActivity());
- textToEdit = textToEdit + "\n/do " + kind + " " + state.getDoActivity().getName();
- }
-
- // exitActivity
- if(state.getExit() != null) {
- String kind = behaviorKindAsString(state.getExit());
- textToEdit = textToEdit + "\n/exit " + kind + " " + state.getExit().getName();
- }
-
- textToEdit += "\n";
- return textToEdit;
- }
-
- @Override
- protected void handleNotificationEvent(Notification notification) {
- // TODO Auto-generated method stub
- super.handleNotificationEvent(notification);
-
- refreshVisuals();
- }
-
- @Override
- protected void refreshVisuals() {
- // TODO Auto-generated method stub
- super.refreshVisuals();
-
- StateFigure stateFigure = ((StateEditPart)getParent()).getPrimaryShape();
- State state = (State)((View)getModel()).getElement();
-
- View stateLabelView = (View)getModel();
- View stateView = (View)stateLabelView.eContainer();
- View stateCompartView = (View)stateView.getChildren().get(1);
-
- if(stateCompartView.getChildren().isEmpty())
- stateFigure.getStateCompartmentFigure().setVisible(false);
- else
- stateFigure.getStateCompartmentFigure().setVisible(true);
-
- stateFigure.fillInformation(getInformationFromState(state));
-
- if(state.isSubmachineState()) {
- stateFigure.setSubmachineStateName(state.getName() + " : " + state.getSubmachine().getQualifiedName());
- stateFigure.setIsSubmachineState(true);
- } else
- stateFigure.setIsSubmachineState(false);
-
-
- int height = 0;
- int width = 0;
- Iterator<IFigure> it = (Iterator<IFigure>)getFigure().getParent().getChildren().iterator();
- while(it.hasNext()) {
- IFigure current = it.next();
- if((current instanceof Label) || (current instanceof WrappingLabel) || (current instanceof StereotypePropertiesCompartment)) {
- Dimension d = current.getPreferredSize().getCopy();
- height += d.height;
- width = Math.max(width, d.width);
- }
- }
-
- width += 10;
-
- int stateHeight = Zone.getHeight(stateView);
- int stateWidth = Zone.getWidth(stateView);
-
- int stateCompartHeight = Zone.getHeight(stateCompartView);
-
- int dx = width - stateWidth;
- int dy = stateCompartHeight + height - stateHeight;
- int x = Zone.getX(stateView);
- int y = Zone.getY(stateView);
-
-
- if((stateHeight != -1) && (width != 0) && (dy != 0)) {
- dx = (dx > 0) ? dx : 0;
- // a resize request, which we route to the specific ResizeCommand
- IAdaptable adaptableForState = new SemanticAdapter(null, stateView);
- ChangeBoundsRequest internalResizeRequest = new ChangeBoundsRequest();
- internalResizeRequest.setResizeDirection(PositionConstants.EAST);
- internalResizeRequest.setSizeDelta(new Dimension(dx, dy));
- Rectangle rect = new Rectangle(x, y, stateWidth + dx, stateHeight + dy);
-
- CustomStateResizeCommand internalResizeCommand = new CustomStateResizeCommand(adaptableForState, getDiagramPreferencesHint(), getEditingDomain(), DiagramUIMessages.CreateCommand_Label, internalResizeRequest, rect, true);
- internalResizeCommand.setOptions(Collections.singletonMap(Transaction.OPTION_UNPROTECTED, Boolean.TRUE));
-
- try {
- internalResizeCommand.execute(null, null);
- } catch (ExecutionException e) {
- }
-
- }
-
-
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomTransitionGuardEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomTransitionGuardEditPart.java
deleted file mode 100644
index 2202366dab5..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomTransitionGuardEditPart.java
+++ /dev/null
@@ -1,115 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.edit.part;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionGuardEditPart;
-import org.eclipse.uml2.uml.Activity;
-import org.eclipse.uml2.uml.CallEvent;
-import org.eclipse.uml2.uml.ChangeEvent;
-import org.eclipse.uml2.uml.Event;
-import org.eclipse.uml2.uml.OpaqueBehavior;
-import org.eclipse.uml2.uml.OpaqueExpression;
-import org.eclipse.uml2.uml.SignalEvent;
-import org.eclipse.uml2.uml.StateMachine;
-import org.eclipse.uml2.uml.TimeEvent;
-import org.eclipse.uml2.uml.Transition;
-import org.eclipse.uml2.uml.Trigger;
-
-
-public class CustomTransitionGuardEditPart extends TransitionGuardEditPart {
-
- public CustomTransitionGuardEditPart(View view) {
- super(view);
- // TODO Auto-generated constructor stub
- }
-
- public String getInformationFromTransition(Transition transition) {
- String textToEdit = "";
-
- // Triggers
- if(!transition.getTriggers().isEmpty()) {
- boolean isFirstTrigger = true;
- for(Trigger t : transition.getTriggers()) {
- if(!isFirstTrigger)
- textToEdit = textToEdit + ", ";
- else
- isFirstTrigger = false;
- Event e = t.getEvent();
- if(e instanceof CallEvent) {
- if(((CallEvent)e).getOperation() != null)
- textToEdit = textToEdit + ((CallEvent)e).getOperation().getName();
- else
- textToEdit = textToEdit + ((CallEvent)e).getName();
-
- } else if(e instanceof SignalEvent) {
- if(((SignalEvent)e).getSignal() != null)
- textToEdit = textToEdit + ((SignalEvent)e).getSignal().getName();
- else
- textToEdit = textToEdit + ((SignalEvent)e).getName();
- } else if(e instanceof ChangeEvent) {
-
- textToEdit = textToEdit + "when " + "\"" + retrieveBody((OpaqueExpression)((ChangeEvent)e).getChangeExpression(), "Natural language") + "\"";
- } else if(e instanceof TimeEvent) {
- String absRelPrefix = "" + (((TimeEvent)e).isRelative() ? "after " : "at ");
- textToEdit = textToEdit + absRelPrefix + "\"" + retrieveBody((OpaqueExpression)((TimeEvent)e).getWhen().getExpr(), "Natural language") + "\"";
- } else { // any receive event
- textToEdit = textToEdit + "all";
- }
- }
- }
-
- // Guard
- if(transition.getGuard() != null && transition.getGuard().getSpecification() != null) {
- textToEdit = textToEdit + " [" + "\"" + retrieveBody((OpaqueExpression)transition.getGuard().getSpecification(), "Natural language") + "\"" + "]";
- }
-
- if(transition.getEffect() != null) {
- textToEdit = textToEdit + " / ";
- String behaviorKind = "";
- behaviorKind = behaviorKind + ((behaviorKind.equals("") && (transition.getEffect() instanceof Activity)) ? "Activity " : "");
- behaviorKind = behaviorKind + ((behaviorKind.equals("") && (transition.getEffect() instanceof StateMachine)) ? "StateMachine " : "");
- behaviorKind = behaviorKind + ((behaviorKind.equals("") && (transition.getEffect() instanceof OpaqueBehavior)) ? "OpaqueBehavior " : "");
- textToEdit = textToEdit + behaviorKind + " " + transition.getEffect().getName();
- }
-
- return textToEdit;
- }
-
- @Override
- protected void handleNotificationEvent(Notification notification) {
- // TODO Auto-generated method stub
- super.handleNotificationEvent(notification);
-
-
- refreshVisuals();
- }
-
- @Override
- protected void refreshVisuals() {
- // TODO Auto-generated method stub
- super.refreshVisuals();
-
- WrappingLabel transitionGuardLabel = (WrappingLabel)getFigure();
- Transition transition = (Transition)((View)getModel()).getElement();
- transitionGuardLabel.setText(getInformationFromTransition(transition));
- }
-
- private String retrieveBody(OpaqueExpression exp, String languageName) {
- String body = "";
- if(exp == null)
- return body;
- int index = 0;
- for(String _languageName : exp.getLanguages()) {
- if(_languageName.equals(languageName)) {
- if(index < exp.getBodies().size())
- return exp.getBodies().get(index);
- else
- return "";
- }
- index++;
- }
- return body;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/expressions/UMLAbstractExpression.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/expressions/UMLAbstractExpression.java
deleted file mode 100644
index c202e7fc943..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/expressions/UMLAbstractExpression.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.diagram.statemachine.custom.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.diagram.statemachine.part.UMLDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public abstract class UMLAbstractExpression {
-
- /**
- * 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(Object value, EDataType targetType) {
- if(targetType instanceof EEnum) {
- if(value instanceof EEnumLiteral) {
- EEnumLiteral literal = (EEnumLiteral)value;
- return (literal.getInstance() != null) ? literal.getInstance() : literal;
- }
- }
- if(false == value instanceof Number || targetType == null || targetType.getInstanceClass() == null) {
- return value;
- }
- Class targetClass = targetType.getInstanceClass();
- Number num = (Number)value;
- 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;
- }
-
- /**
- * @generated
- */
- private IStatus status = Status.OK_STATUS;
-
- /**
- * @generated
- */
- private final String myBody;
-
- /**
- * @generated
- */
- private final EClassifier myContext;
-
- /**
- * @generated
- */
- protected UMLAbstractExpression(String body, EClassifier context) {
- myBody = body;
- myContext = context;
- }
-
- /**
- * @generated
- */
- public String body() {
- return myBody;
- }
-
- /**
- * @generated
- */
- public EClassifier context() {
- return myContext;
- }
-
- /**
- * @generated
- */
- protected abstract Object doEvaluate(Object context, Map env);
-
- /**
- * @generated
- */
- public Object evaluate(Object context) {
- return evaluate(context, Collections.EMPTY_MAP);
- }
-
- /**
- * @generated
- */
- public Object evaluate(Object context, Map env) {
- if(context().isInstance(context)) {
- try {
- return doEvaluate(context, env);
- } catch (Exception e) {
- UMLDiagramEditorPlugin.getInstance().logError("Expression evaluation failure: " + body(), e); //$NON-NLS-1$
- }
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IStatus getStatus() {
- return status;
- }
-
- /**
- * @generated
- */
- protected void setStatus(int severity, String message, Throwable throwable) {
- 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$
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/factory/CustomUMLEditPartFactory.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/factory/CustomUMLEditPartFactory.java
deleted file mode 100644
index 13bd511d28e..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/factory/CustomUMLEditPartFactory.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.factory;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.custom.edit.part.CustomConnectionPointReferenceNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.custom.edit.part.CustomFinalStateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.custom.edit.part.CustomPackageEditPart;
-import org.eclipse.papyrus.diagram.statemachine.custom.edit.part.CustomRegionCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.custom.edit.part.CustomRegionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.custom.edit.part.CustomStateCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.custom.edit.part.CustomStateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.custom.edit.part.CustomStateMachineCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.custom.edit.part.CustomStateMachineEditPart;
-import org.eclipse.papyrus.diagram.statemachine.custom.edit.part.CustomStateMachineNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.custom.edit.part.CustomStateNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.custom.edit.part.CustomTransitionGuardEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.ConnectionPointReferenceNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.FinalStateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionGuardEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.UMLEditPartFactory;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-
-public class CustomUMLEditPartFactory extends UMLEditPartFactory {
-
- public EditPart createEditPart(EditPart context, Object model) {
- if(model instanceof View) {
- View view = (View)model;
- switch(UMLVisualIDRegistry.getVisualID(view)) {
- // redefined classes to modify the method createNodePlate
- case PackageEditPart.VISUAL_ID:
- return new CustomPackageEditPart(view);
- case StateMachineEditPart.VISUAL_ID:
- return new CustomStateMachineEditPart(view);
- case StateMachineNameEditPart.VISUAL_ID:
- return new CustomStateMachineNameEditPart(view);
- case StateMachineCompartmentEditPart.VISUAL_ID:
- return new CustomStateMachineCompartmentEditPart(view);
- case RegionCompartmentEditPart.VISUAL_ID:
- return new CustomRegionCompartmentEditPart(view);
- case RegionEditPart.VISUAL_ID:
- return new CustomRegionEditPart(view);
- case FinalStateEditPart.VISUAL_ID:
- return new CustomFinalStateEditPart(view);
- case StateEditPart.VISUAL_ID:
- return new CustomStateEditPart(view);
- case StateNameEditPart.VISUAL_ID:
- return new CustomStateNameEditPart(view);
- case StateCompartmentEditPart.VISUAL_ID:
- return new CustomStateCompartmentEditPart(view);
- case TransitionGuardEditPart.VISUAL_ID:
- return new CustomTransitionGuardEditPart(view);
- case ConnectionPointReferenceNameEditPart.VISUAL_ID:
- return new CustomConnectionPointReferenceNameEditPart(view);
-
- }
-
- }
- return super.createEditPart(context, model);
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/ConnectionPointReferenceFigure.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/ConnectionPointReferenceFigure.java
deleted file mode 100644
index 3e60817cab1..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/ConnectionPointReferenceFigure.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 CEA List.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA List - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.diagram.statemachine.custom.figures;
-
-import java.util.Iterator;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.papyrus.diagram.common.figure.node.AffixedNamedElementFigure;
-
-/**
- * ConnectionPointReferenceFigure.
- *
- */
-public class ConnectionPointReferenceFigure extends AffixedNamedElementFigure {
-
- /**
- * kind
- */
- protected int kind = 0;
-
-
- /**
- * Default Constructor.
- */
- public ConnectionPointReferenceFigure() {
- super();
- Dimension dim1 = new Dimension(22, 22);
- this.setPreferredSize(new Dimension(dim1));
- this.setMaximumSize(new Dimension(dim1));
- this.setMinimumSize(new Dimension(dim1));
- this.setSize(dim1);
-
- }
-
- @Override
- public void setName(String name) {
- // TODO Auto-generated method stub
- super.setName(name);
- }
-
- @Override
- public void paint(Graphics graphics) {
- graphics.pushState();
-
- IFigure ancestor = getParent();
- while((ancestor != null) && !(ancestor instanceof RegionFigure))
- ancestor = ancestor.getParent();
- if(ancestor != null) {
- if(((RegionFigure)ancestor).getBorderColor() != null)
- graphics.setForegroundColor(((RegionFigure)ancestor).getBorderColor());
- if(((RegionFigure)ancestor).getBackgroundColor() != null)
- graphics.setBackgroundColor(((RegionFigure)ancestor).getBackgroundColor());
- } else {
- ancestor = getParent();
- Iterator it = ancestor.getChildren().iterator();
- boolean found = false;
- while(it.hasNext() && !found) {
- ancestor = (IFigure)it.next();
- if(ancestor instanceof StateMachineFigure)
- found = true;
- }
- if(found) {
- if(((StateMachineFigure)ancestor).getBorderColor() != null)
- graphics.setForegroundColor(((StateMachineFigure)ancestor).getBorderColor());
- if(((StateMachineFigure)ancestor).getBackgroundColor() != null)
- graphics.setBackgroundColor(((StateMachineFigure)ancestor).getBackgroundColor());
- }
- }
- graphics.setLineWidth(1);
- Rectangle r = Rectangle.SINGLETON;
- r.setBounds(getBounds());
- r.width -= 2;
- r.height -= 2;
- graphics.drawOval(r);
- r.shrink(1, 1);
- graphics.fillOval(r);
-
- if(kind == 0) {
-
- r.x += r.width / 4;
- r.y += r.height / 7;
- r.width = r.width / 2;
- r.height = r.height / 2;
- graphics.setForegroundColor(ColorConstants.black);
- graphics.setBackgroundColor(ColorConstants.black);
- graphics.setLineWidth(2);
- graphics.drawArc(r, 0, 180);
- r.x += r.width / 2;
- r.y += r.height / 2;
- graphics.drawArc(r, 90, 90);
-
-
- r.x -= r.width / 4 - 1;
- r.y += 0.75 * r.height;
- r.width = Math.max((int)r.width / 2, 2);
- r.height = Math.max((int)r.height / 2, 2);
- graphics.fillOval(r);
- } else {
- if(kind == 2) {
- // intersection coordinates.
- int x = (int)(bounds.width / (2 * Math.sqrt(2)));
- int y = (int)(bounds.height / (2 * Math.sqrt(2)));
-
- // cross.
- graphics.drawLine(bounds.getCenter().translate(x, -y), bounds.getCenter().translate(-x, y));
- graphics.drawLine(bounds.getCenter().translate(-x, -y), bounds.getCenter().translate(x, y));
- }
- }
-
-
- graphics.popState();
- }
-
- public void setKind(int kind) {
- this.kind = kind;
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/CustomShapeCompartmentFigure.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/CustomShapeCompartmentFigure.java
deleted file mode 100644
index 3ccbd0caefc..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/CustomShapeCompartmentFigure.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.figures;
-
-import org.eclipse.draw2d.ScrollPane;
-import org.eclipse.gmf.runtime.diagram.ui.figures.ShapeCompartmentFigure;
-import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
-
-public class CustomShapeCompartmentFigure extends ShapeCompartmentFigure {
-
- public CustomShapeCompartmentFigure(String compartmentTitle, IMapMode mm) {
- super(compartmentTitle, mm);
-
- setTitleVisibility(false);
-
- scrollPane.setScrollBarVisibility(ScrollPane.NEVER);
- scrollPane.setBorder(null);
- }
-
- @Override
- protected void configureFigure(IMapMode mm) {
- super.configureFigure(mm);
- scrollPane.setScrollBarVisibility(ScrollPane.NEVER);
- scrollPane.setBorder(null);
- setBorder(null);
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/FinalStateFigure.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/FinalStateFigure.java
deleted file mode 100644
index 4f07d70c5e8..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/FinalStateFigure.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.figures;
-
-import org.eclipse.draw2d.Border;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Insets;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.papyrus.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
-import org.eclipse.papyrus.diagram.common.figure.node.PapyrusNodeFigure;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-
-public class FinalStateFigure extends PapyrusNodeFigure implements IPapyrusNodeUMLElementFigure {
-
- /**
- * {@inheritDoc}
- */
- protected Border getDefaultBorder(Color borderColor) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Dimension getPreferredSize(int wHint, int hHint) {
- // TODO Auto-generated method stub
- return new Dimension(20, 20);
- }
-
- /**
- * {@inheritDoc}
- */
- public Label getStereotypesLabel() {
- return new Label();
- }
-
- /**
- * {@inheritDoc}
- */
- public void paintFigure(Graphics graphics) {
-
- final int space = 3;
- Rectangle f = Rectangle.SINGLETON;
- //to be in adequation with the figure node plate
- Rectangle r = getBounds().getCopy().crop(new Insets(0, 0, 1, 1));
- graphics.setBackgroundColor(getForegroundColor());
- graphics.setLineWidth(1);
- graphics.drawOval(r);
- f.x = r.x + space;
- f.y = r.y + space;
- f.width = r.width - space * 2 + 1;
- f.height = r.height - space * 2 + 1;
- graphics.setBackgroundColor(getForegroundColor());
- graphics.fillOval(f);
-
-
- }
-
- /**
- * {@inheritDoc}
- */
- public void setStereotypeDisplay(String stereotypes, Image image) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * {@inheritDoc}
- */
- public void setStereotypePropertiesInBrace(String stereotypeProperties) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * {@inheritDoc}
- */
- public void setStereotypePropertiesInCompartment(String stereotypeProperties) {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateChoiceFigure.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateChoiceFigure.java
deleted file mode 100644
index 4249dfca478..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateChoiceFigure.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.figures;
-
-import org.eclipse.draw2d.Border;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Insets;
-import org.eclipse.draw2d.geometry.PointList;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
-import org.eclipse.papyrus.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
-import org.eclipse.papyrus.diagram.common.figure.node.PapyrusNodeFigure;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-
-public class PseudostateChoiceFigure extends PapyrusNodeFigure implements IPapyrusNodeUMLElementFigure {
-
- /**
- *
- * {@inheritDoc}
- */
- protected Border getDefaultBorder(Color borderColor) {
- return null;
- }
-
- /**
- *
- * {@inheritDoc}
- */
- @Override
- public Dimension getPreferredSize(int wHint, int hHint) {
- // TODO Auto-generated method stub
- return new Dimension(20, 20);
- }
-
- /**
- * {@inheritDoc}
- */
- public Label getStereotypesLabel() {
- return new Label();
- }
-
- /**
- * {@inheritDoc}
- */
- public void paintFigure(Graphics graphics) {
- graphics.pushState();
- Rectangle r = getBounds().getCopy().crop(new Insets(0, 0, 1, 1));
-
- int lineWidth = graphics.getLineWidth();
- r.x = r.x + lineWidth / 2;
- r.y = r.y + lineWidth / 2;
- r.width = r.width - lineWidth - 1;
- r.height = r.height - lineWidth - 1;
-
- PointList pl = new PointList();
- pl.addPoint(r.getTop());
- pl.addPoint(r.getRight());
- pl.addPoint(r.getBottom());
- pl.addPoint(r.getLeft());
-
- if(isUsingGradient()) {
- graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor2()));
- //graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2()));
- } else {
- graphics.setBackgroundColor(getBackgroundColor());
- //graphics.setForegroundColor(getBackgroundColor);
- }
- graphics.fillPolygon(pl);
- graphics.setLineWidth(1);
- graphics.setBackgroundColor(getForegroundColor());
- graphics.drawPolygon(pl);
- graphics.popState();
-
-
- }
-
- /**
- * {@inheritDoc}
- */
- public void setStereotypeDisplay(String stereotypes, Image image) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * {@inheritDoc}
- */
- public void setStereotypePropertiesInBrace(String stereotypeProperties) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * {@inheritDoc}
- */
- public void setStereotypePropertiesInCompartment(String stereotypeProperties) {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateDeepHistoryFigure.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateDeepHistoryFigure.java
deleted file mode 100644
index ee6247e69e8..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateDeepHistoryFigure.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.figures;
-
-import org.eclipse.draw2d.Border;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Insets;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.papyrus.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
-import org.eclipse.papyrus.diagram.common.figure.node.PapyrusNodeFigure;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-
-public class PseudostateDeepHistoryFigure extends PapyrusNodeFigure implements IPapyrusNodeUMLElementFigure {
-
- /**
- * {@inheritDoc}
- */
- protected Border getDefaultBorder(Color borderColor) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Dimension getPreferredSize(int wHint, int hHint) {
- // TODO Auto-generated method stub
- return new Dimension(22, 22);
- }
-
- /**
- * {@inheritDoc}
- */
- public Label getStereotypesLabel() {
- return new Label();
- }
-
- /**
- * {@inheritDoc}
- */
- public void paintFigure(Graphics graphics) {
-
- final int space = 5;
- Rectangle f = Rectangle.SINGLETON;
- //to be in adequation with the figure node plate
- Rectangle r = getBounds().getCopy().crop(new Insets(1, 1, 1, 1));
- graphics.setBackgroundColor(getForegroundColor());
- graphics.setLineWidth(1);
- graphics.drawOval(r);
-
- // 'H' letter
- graphics.drawLine(bounds.getCenter().getTranslated((int)(-bounds.width * 0.25), (int)(-bounds.height * 0.25)), bounds.getCenter().getTranslated((int)(-bounds.width * 0.25), (int)(bounds.height * 0.25)));
- graphics.drawLine(bounds.getCenter().getTranslated((int)(bounds.width * 0.05), (int)(-bounds.height * 0.25)), bounds.getCenter().getTranslated((int)(bounds.width * 0.05), (int)(bounds.height * 0.25)));
- graphics.drawLine(bounds.getCenter().getTranslated((int)(-bounds.width * 0.25), 0), bounds.getCenter().getTranslated((int)(bounds.width * 0.05), 0));
-
- // '*' character
- graphics.drawLine(bounds.getCenter().getTranslated((int)(bounds.width * 0.25), (int)(-bounds.height * 0.25)), bounds.getCenter().getTranslated((int)(bounds.width * 0.25), (int)(-bounds.height * 0.05)));
- graphics.drawLine(bounds.getCenter().getTranslated((int)(bounds.width * 0.15), (int)(-bounds.height * 0.20)), bounds.getCenter().getTranslated((int)(bounds.width * 0.35), (int)(-bounds.height * 0.10)));
- graphics.drawLine(bounds.getCenter().getTranslated((int)(bounds.width * 0.35), (int)(-bounds.height * 0.20)), bounds.getCenter().getTranslated((int)(bounds.width * 0.15), (int)(-bounds.height * 0.10)));
-
-
- }
-
- /**
- * {@inheritDoc}
- */
- public void setStereotypeDisplay(String stereotypes, Image image) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * {@inheritDoc}
- */
- public void setStereotypePropertiesInBrace(String stereotypeProperties) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * {@inheritDoc}
- */
- public void setStereotypePropertiesInCompartment(String stereotypeProperties) {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateEntryPointFigure.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateEntryPointFigure.java
deleted file mode 100644
index df5ed652330..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateEntryPointFigure.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 CEA List.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA List - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.diagram.statemachine.custom.figures;
-
-import java.util.Iterator;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.papyrus.diagram.common.figure.node.AffixedNamedElementFigure;
-
-/**
- * PseudostateEntryPointFigure.
- *
- */
-public class PseudostateEntryPointFigure extends AffixedNamedElementFigure {
-
- /**
- * Default Constructor.
- */
- public PseudostateEntryPointFigure() {
- super();
- Dimension dim1 = new Dimension(22, 22);
- this.setPreferredSize(new Dimension(dim1));
- this.setMaximumSize(new Dimension(dim1));
- this.setMinimumSize(new Dimension(dim1));
- this.setSize(dim1);
-
- }
-
-
- @Override
- public void paint(Graphics graphics) {
- graphics.pushState();
-
- IFigure ancestor = getParent();
- while((ancestor != null) && !(ancestor instanceof RegionFigure))
- ancestor = ancestor.getParent();
- if(ancestor != null) {
- if(((RegionFigure)ancestor).getBorderColor() != null)
- graphics.setForegroundColor(((RegionFigure)ancestor).getBorderColor());
- if(((RegionFigure)ancestor).getBackgroundColor() != null)
- graphics.setBackgroundColor(((RegionFigure)ancestor).getBackgroundColor());
- } else {
- ancestor = getParent();
- Iterator it = ancestor.getChildren().iterator();
- boolean found = false;
- while(it.hasNext() && !found) {
- ancestor = (IFigure)it.next();
- if(ancestor instanceof StateMachineFigure)
- found = true;
- }
- if(found) {
- if(((StateMachineFigure)ancestor).getBorderColor() != null)
- graphics.setForegroundColor(((StateMachineFigure)ancestor).getBorderColor());
- if(((StateMachineFigure)ancestor).getBackgroundColor() != null)
- graphics.setBackgroundColor(((StateMachineFigure)ancestor).getBackgroundColor());
- }
- }
- graphics.setLineWidth(1);
- Rectangle r = Rectangle.SINGLETON;
- r.setBounds(getBounds());
- r.width -= 2;
- r.height -= 2;
- graphics.drawOval(r);
- r.shrink(1, 1);
- graphics.fillOval(r);
- graphics.popState();
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateExitPointFigure.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateExitPointFigure.java
deleted file mode 100644
index 5dbc665deca..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateExitPointFigure.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 CEA List.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA List - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.diagram.statemachine.custom.figures;
-
-import java.util.Iterator;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.papyrus.diagram.common.figure.node.AffixedNamedElementFigure;
-
-/**
- * PseudostateExitPointFigure.
- *
- */
-public class PseudostateExitPointFigure extends AffixedNamedElementFigure {
-
- /**
- * Default Constructor.
- */
- public PseudostateExitPointFigure() {
- super();
- Dimension dim1 = new Dimension(22, 22);
- this.setPreferredSize(new Dimension(dim1));
- this.setMaximumSize(new Dimension(dim1));
- this.setMinimumSize(new Dimension(dim1));
- this.setSize(dim1);
-
- }
-
-
- @Override
- public void paint(Graphics graphics) {
- graphics.pushState();
- IFigure ancestor = getParent();
- while((ancestor != null) && !(ancestor instanceof RegionFigure))
- ancestor = ancestor.getParent();
- if(ancestor != null) {
- if(((RegionFigure)ancestor).getBorderColor() != null)
- graphics.setForegroundColor(((RegionFigure)ancestor).getBorderColor());
- if(((RegionFigure)ancestor).getBackgroundColor() != null)
- graphics.setBackgroundColor(((RegionFigure)ancestor).getBackgroundColor());
- } else {
- ancestor = getParent();
- Iterator it = ancestor.getChildren().iterator();
- boolean found = false;
- while(it.hasNext() && !found) {
- ancestor = (IFigure)it.next();
- if(ancestor instanceof StateMachineFigure)
- found = true;
- }
- if(found) {
- if(((StateMachineFigure)ancestor).getBorderColor() != null)
- graphics.setForegroundColor(((StateMachineFigure)ancestor).getBorderColor());
- if(((StateMachineFigure)ancestor).getBackgroundColor() != null)
- graphics.setBackgroundColor(((StateMachineFigure)ancestor).getBackgroundColor());
- }
- }
- graphics.setLineWidth(1);
- Rectangle r = Rectangle.SINGLETON;
- r.setBounds(getBounds());
- r.width -= 2;
- r.height -= 2;
- graphics.drawOval(r);
- r.shrink(1, 1);
- graphics.fillOval(r);
-
- // intersection coordinates.
- int x = (int)(bounds.width / (2 * Math.sqrt(2)));
- int y = (int)(bounds.height / (2 * Math.sqrt(2)));
-
- // cross.
- graphics.drawLine(bounds.getCenter().translate(x - 1, -y), bounds.getCenter().translate(-x, y - 2));
- graphics.drawLine(bounds.getCenter().translate(-x, -y), bounds.getCenter().translate(x - 1, y - 2));
-
- graphics.popState();
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateInitialFigure.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateInitialFigure.java
deleted file mode 100644
index 0c68f43d10c..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateInitialFigure.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.figures;
-
-import org.eclipse.draw2d.Border;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.papyrus.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
-import org.eclipse.papyrus.diagram.common.figure.node.PapyrusNodeFigure;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-
-public class PseudostateInitialFigure extends PapyrusNodeFigure implements IPapyrusNodeUMLElementFigure {
-
- /**
- * {@inheritDoc}
- */
- protected Border getDefaultBorder(Color borderColor) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Dimension getPreferredSize(int wHint, int hHint) {
- return new Dimension(20, 20);
- }
-
- /**
- * {@inheritDoc}
- */
- public Label getStereotypesLabel() {
- return new Label();
- }
-
- // public PseudostateInitialFigure() {
- // super();
- // Dimension dim1 = new Dimension(20, 20);
- // this.setPreferredSize(new Dimension(dim1));
- // this.setMaximumSize(new Dimension(dim1));
- // this.setMinimumSize(new Dimension(dim1));
- // this.setSize(dim1);
- // }
- //
- // /**
- // * Fills the circle.
- // *
- // * @param graphics
- // * the graphics
- // *
- // * @see org.eclipse.draw2d.Shape#fillShape(org.eclipse.draw2d.Graphics)
- // */
- // protected void fillShape(Graphics graphics) {
- // graphics.pushState();
- // graphics.setBackgroundColor(ColorConstants.black);
- // graphics.fillOval(getBounds());
- // graphics.popState();
- //
- // }
- /**
- * {@inheritDoc}
- */
- public void paintFigure(Graphics graphics) {
- Rectangle r = getBounds().getCopy();
- graphics.setBackgroundColor(getForegroundColor());
- graphics.fillOval(r);
- }
-
- /**
- * {@inheritDoc}
- */
- public void setStereotypeDisplay(String stereotypes, Image image) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void setStereotypePropertiesInBrace(String stereotypeProperties) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void setStereotypePropertiesInCompartment(String stereotypeProperties) {
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateJoinForkFigure.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateJoinForkFigure.java
deleted file mode 100644
index c47477ea37e..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateJoinForkFigure.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.figures;
-
-import org.eclipse.draw2d.Border;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Insets;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
-import org.eclipse.papyrus.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
-import org.eclipse.papyrus.diagram.common.figure.node.PapyrusNodeFigure;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-
-public class PseudostateJoinForkFigure extends PapyrusNodeFigure implements IPapyrusNodeUMLElementFigure {
-
- /**
- * {@inheritDoc}
- */
- protected Border getDefaultBorder(Color borderColor) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Dimension getPreferredSize(int wHint, int hHint) {
- return new Dimension(10, 10);
- }
-
- /**
- * {@inheritDoc}
- */
- public Label getStereotypesLabel() {
- return new Label();
- }
-
- /**
- * {@inheritDoc}
- */
- public void paintFigure(Graphics graphics) {
- Rectangle r = getBounds().getCopy().crop(new Insets(0, 0, 1, 1));
- if(isUsingGradient()) {
- graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor2()));
- //graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2()));
- } else {
- graphics.setBackgroundColor(getBackgroundColor());
- //graphics.setForegroundColor(getForegroundColor());
- }
- graphics.fillRectangle(r);
- graphics.setLineWidth(1);
- graphics.drawRectangle(r);
- }
-
- /**
- * {@inheritDoc}
- */
- public void setStereotypeDisplay(String stereotypes, Image image) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void setStereotypePropertiesInBrace(String stereotypeProperties) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void setStereotypePropertiesInCompartment(String stereotypeProperties) {
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateJunctionFigure.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateJunctionFigure.java
deleted file mode 100644
index 3f99e102147..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateJunctionFigure.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.figures;
-
-import org.eclipse.draw2d.Border;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.papyrus.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
-import org.eclipse.papyrus.diagram.common.figure.node.PapyrusNodeFigure;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-
-public class PseudostateJunctionFigure extends PapyrusNodeFigure implements IPapyrusNodeUMLElementFigure {
-
- /**
- * {@inheritDoc}
- */
- protected Border getDefaultBorder(Color borderColor) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Dimension getPreferredSize(int wHint, int hHint) {
- return new Dimension(10, 10);
- }
-
- /**
- * {@inheritDoc}
- */
- public Label getStereotypesLabel() {
- return new Label();
- }
-
- // public PseudostateJunctionFigure() {
- // super();
- // Dimension dim1 = new Dimension(22, 22);
- // this.setPreferredSize(new Dimension(dim1));
- // this.setMaximumSize(new Dimension(dim1));
- // this.setMinimumSize(new Dimension(dim1));
- // this.setSize(dim1);
- // }
- //
- // protected void fillShape(Graphics graphics) {
- // graphics.pushState();
- // graphics.setBackgroundColor(ColorConstants.black);
- // graphics.fillOval(getBounds());
- // graphics.popState();
- // }
- /**
- * {@inheritDoc}
- */
- public void paintFigure(Graphics graphics) {
- Rectangle r = getBounds().getCopy();
- graphics.setBackgroundColor(getForegroundColor());
- graphics.fillOval(r);
- }
-
- /**
- * {@inheritDoc}
- */
- public void setStereotypeDisplay(String stereotypes, Image image) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void setStereotypePropertiesInBrace(String stereotypeProperties) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void setStereotypePropertiesInCompartment(String stereotypeProperties) {
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateShallowHistoryFigure.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateShallowHistoryFigure.java
deleted file mode 100644
index 4a6a1afb40f..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateShallowHistoryFigure.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.figures;
-
-import org.eclipse.draw2d.Border;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Insets;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.papyrus.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
-import org.eclipse.papyrus.diagram.common.figure.node.PapyrusNodeFigure;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-
-public class PseudostateShallowHistoryFigure extends PapyrusNodeFigure implements IPapyrusNodeUMLElementFigure {
-
- /**
- * {@inheritDoc}
- */
- protected Border getDefaultBorder(Color borderColor) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Dimension getPreferredSize(int wHint, int hHint) {
- // TODO Auto-generated method stub
- return new Dimension(22, 22);
- }
-
- /**
- * {@inheritDoc}
- */
- public Label getStereotypesLabel() {
- return new Label();
- }
-
- /**
- * {@inheritDoc}
- */
- public void paintFigure(Graphics graphics) {
-
- final int space = 5;
- Rectangle f = Rectangle.SINGLETON;
- //to be in adequation with the figure node plate
- Rectangle r = getBounds().getCopy().crop(new Insets(1, 1, 1, 1));
- graphics.setLineWidth(1);
- graphics.setBackgroundColor(getForegroundColor());
- graphics.drawOval(r);
-
- // 'H' letter
- graphics.drawLine(bounds.getCenter().getTranslated((int)(-bounds.width * 0.15), (int)(-bounds.height * 0.25)), bounds.getCenter().getTranslated((int)(-bounds.width * 0.15), (int)(bounds.height * 0.25)));
- graphics.drawLine(bounds.getCenter().getTranslated((int)(bounds.width * 0.15), (int)(-bounds.height * 0.25)), bounds.getCenter().getTranslated((int)(bounds.width * 0.15), (int)(bounds.height * 0.25)));
- graphics.drawLine(bounds.getCenter().getTranslated((int)(-bounds.width * 0.15), 0), bounds.getCenter().getTranslated((int)(bounds.width * 0.15), 0));
-
-
- }
-
- /**
- * {@inheritDoc}
- */
- public void setStereotypeDisplay(String stereotypes, Image image) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * {@inheritDoc}
- */
- public void setStereotypePropertiesInBrace(String stereotypeProperties) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * {@inheritDoc}
- */
- public void setStereotypePropertiesInCompartment(String stereotypeProperties) {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateTerminateFigure.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateTerminateFigure.java
deleted file mode 100644
index 14d90178d45..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/PseudostateTerminateFigure.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 CEA List.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA List - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.diagram.statemachine.custom.figures;
-
-import org.eclipse.draw2d.Border;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Insets;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
-import org.eclipse.papyrus.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
-import org.eclipse.papyrus.diagram.common.figure.node.PapyrusNodeFigure;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * PseudostateTerminateFigure.
- *
- */
-public class PseudostateTerminateFigure extends PapyrusNodeFigure implements IPapyrusNodeUMLElementFigure {
-
- /**
- * {@inheritDoc}
- */
- protected Border getDefaultBorder(Color borderColor) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Dimension getPreferredSize(int wHint, int hHint) {
- return new Dimension(20, 20);
- }
-
- /**
- * {@inheritDoc}
- */
- public Label getStereotypesLabel() {
- return new Label();
- }
-
- /**
- * {@inheritDoc}
- */
- public void paintFigure(Graphics graphics) {
-
- graphics.setForegroundColor(getForegroundColor());
- Rectangle r = getBounds().getCopy().crop(new Insets(0, 0, 1, 1));
- if(isUsingGradient()) {
- graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor2()));
- //graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2()));
- } else {
- graphics.setBackgroundColor(getBackgroundColor());
- //graphics.setForegroundColor(getForegroundColor());
- }
- graphics.setLineWidth(1);
- // intersection coordinates.
- int x = (int)(r.width / (2 * Math.sqrt(2)));
- int y = (int)(r.height / (2 * Math.sqrt(2)));
-
- // cross.
- graphics.drawLine(r.getCenter().translate(x, -y), r.getCenter().translate(-x, y));
- graphics.drawLine(r.getCenter().translate(-x, -y), r.getCenter().translate(x, y));
- }
-
- /**
- * {@inheritDoc}
- */
- public void setStereotypeDisplay(String stereotypes, Image image) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void setStereotypePropertiesInBrace(String stereotypeProperties) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void setStereotypePropertiesInCompartment(String stereotypeProperties) {
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/RegionFigure.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/RegionFigure.java
deleted file mode 100644
index 8baae7161ab..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/RegionFigure.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.figures;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.papyrus.diagram.common.figure.node.AutomaticCompartmentLayoutManager;
-import org.eclipse.papyrus.diagram.common.figure.node.CompartmentFigure;
-import org.eclipse.swt.SWT;
-
-public class RegionFigure extends CompartmentFigure {
-
- /** The Region Compartment */
- private final static String REGION_COMPARTMENT = "regionCompartment";
-
- /** The List of Compartment */
- private final static List<String> COMPARTMENT = new ArrayList<String>() {
-
- private static final long serialVersionUID = 1L;
- {
- add(REGION_COMPARTMENT);
- }
- };
-
- /**
- * Specific flags to turn on/off dashed border on the BOTTOM side.
- */
- private boolean displayBottomBorder = false;
-
- /**
- * Specific flag to turn on/off dashed border on the RIGHT side.
- */
- private boolean displayRightBorder = false;
-
- /**
- * Default Constructor
- */
- public RegionFigure() {
- this(null);
- setBorder(null);
- }
-
- /**
- * Create a new Region figure with the given tag
- *
- * @param tagLabel
- * a String that will be displayed at the top of the figure
- */
- public RegionFigure(String tagLabel) {
- super(COMPARTMENT, tagLabel);
- ((AutomaticCompartmentLayoutManager)getLayoutManager()).setAddExtraHeight(false);
- setBorder(null);
-
-
- }
-
- /**
- * Get the region compartment figure
- *
- * @return
- */
- public RectangleFigure getRegionCompartmentFigure() {
- return getCompartment(REGION_COMPARTMENT);
- }
-
- @Override
- protected void paintBorder(Graphics graphics) {
- }
-
- @Override
- public void paintFigure(Graphics graphics) {
- // TODO Auto-generated method stub
- super.paintFigure(graphics);
- graphics.setForegroundColor(getForegroundColor());
- Rectangle rect = getBounds();
- // the specific drawing of borders
- if(displayRightBorder) {
- graphics.setLineStyle(SWT.BORDER_DASH);
- graphics.setLineWidth(SWT.BOLD);
-
- graphics.drawLine(rect.x + rect.width - 1, rect.y - 2, rect.x + rect.width - 1, rect.y - 2 + rect.height);
- }
- if(displayBottomBorder) {
- graphics.setLineStyle(SWT.BORDER_DASH);
- graphics.setLineWidth(SWT.BOLD);
-
- graphics.drawLine(rect.x - 2, rect.y + rect.height - 1, rect.x - 2 + rect.width, rect.y + rect.height - 1);
- }
- }
-
- /**
- * Specific flags to turn on/off of a dashed border on the BOTTOM side.
- *
- * @param b
- */
- public void setDisplayBottomBorder(boolean b) {
- displayBottomBorder = b;
- }
-
- /**
- * Specific flags to turn on/off of a dashed border on the RIGHT side.
- *
- * @param b
- */
- public void setDisplayRightBorder(boolean b) {
- displayRightBorder = b;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/RoundedBorder.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/RoundedBorder.java
deleted file mode 100644
index c609bd5995a..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/RoundedBorder.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Insets;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.RoundedRectangleBorder;
-
-/**
- * Fixes a bug in GMF RoundedRectangleBorder: when lineWidth is 1 then the
- * border is not shown entirely. See paint method.
- *
- * @author David
- *
- */
-public class RoundedBorder extends RoundedRectangleBorder {
-
- public RoundedBorder(int arcWidth, int arcHeight) {
- super(arcWidth, arcHeight);
- // TODO Auto-generated constructor stub
- }
-
- @Override
- public void paint(IFigure figure, Graphics graphics, Insets insets) {
- tempRect.setBounds(getPaintRectangle(figure, insets));
-
- // bug fix when lineWidth is 1
- if(getWidth() % 2 == 1) {
- tempRect.width--;
- tempRect.height--;
- }
-
- // Shrink to accommodate for the line width
- tempRect.shrink(getWidth() / 2, getWidth() / 2);
-
- graphics.setLineWidth(getWidth());
- graphics.setLineStyle(getStyle());
- // If the color for this border is specified, then use it.
- // Otherwise, use the figure's foreground color
- if(getColor() != null) {
- graphics.setForegroundColor(getColor());
- } else {
- graphics.setForegroundColor(figure.getForegroundColor());
- }
-
- graphics.drawRoundRectangle(tempRect, getArcWidth(), getArcHeight());
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/RoundedShadowBorder.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/RoundedShadowBorder.java
deleted file mode 100644
index a16c1f3ef85..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/RoundedShadowBorder.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Insets;
-import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeUtil;
-import org.eclipse.papyrus.diagram.common.figure.node.RectangularShadowBorder;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * Rounded shadow border, extends RectangularShadowBorder otherwise problem in
- * hierarchy of figures Works with borderwidth of 3 and arcwidth of 20
- *
- * @author David
- *
- */
-public class RoundedShadowBorder extends RectangularShadowBorder {
-
- int borderwidth;
-
- int arcwidth;
-
- public RoundedShadowBorder(Color color) {
- super(3, color);
- this.borderwidth = 3;
- arcwidth = 20;
- setWidth(1);
- }
-
- /**
- * Method for determining the inset the border will take up on the shape.
- *
- * @param figure
- * Figure that will be inset from the border
- * @return Insets the Insets for the border on the given figure.
- */
- @Override
- public Insets getInsets(IFigure figure) {
- Insets insetsNew = super.getInsets(figure);
- insetsNew.top = 0;
- insetsNew.left = 0;
- insetsNew.bottom = MapModeUtil.getMapMode(figure).DPtoLP(insetsNew.bottom + borderwidth);
- insetsNew.right = MapModeUtil.getMapMode(figure).DPtoLP(insetsNew.right + borderwidth);
- return insetsNew;
- }
-
- /**
- * @see org.eclipse.draw2d.Border#paint(IFigure, Graphics, Insets)
- */
- @Override
- public void paint(IFigure figure, Graphics graphics, Insets insets) {
- // draw the normal line border
- tempRect.setBounds(getPaintRectangle(figure, insets));
-
- if(getWidth() % 2 == 1) {
- tempRect.width--;
- tempRect.height--;
- }
-
- tempRect.shrink(getWidth() / 2 + 1, getWidth() / 2 + 1).translate(-1, -1);
- graphics.setLineWidth(getWidth());
- if(getColor() != null)
- graphics.setForegroundColor(getColor());
- graphics.drawRoundRectangle(tempRect, arcwidth, arcwidth);
-
- graphics.setBackgroundColor(getColor());
-
- // graphics.drawArc(tempRect.x+tempRect.width-arcwidth+borderwidth,
- // tempRect.y+borderwidth,
- // arcwidth, arcwidth, 0, 50);
- graphics.drawArc(tempRect.x + tempRect.width - arcwidth + borderwidth, tempRect.y + borderwidth, arcwidth - 1, arcwidth - 1, 0, 40);
- // graphics.drawArc(tempRect.x+tempRect.width-arcwidth+borderwidth,
- // tempRect.y+borderwidth,
- // arcwidth-2, arcwidth-2, 0, 20);
-
- // graphics.drawArc(tempRect.x+tempRect.width-arcwidth+borderwidth,
- // tempRect.y+borderwidth+tempRect.height-arcwidth, arcwidth, arcwidth,
- // 270, 90);
- graphics.drawArc(tempRect.x + tempRect.width - arcwidth + borderwidth, tempRect.y + borderwidth + tempRect.height - arcwidth, arcwidth - 1, arcwidth - 1, 270, 90);
- graphics.drawArc(tempRect.x + tempRect.width - arcwidth + borderwidth, tempRect.y + borderwidth + tempRect.height - arcwidth, arcwidth - 2, arcwidth - 2, 270, 90);
- graphics.drawArc(tempRect.x + tempRect.width - arcwidth + borderwidth, tempRect.y + borderwidth + tempRect.height - arcwidth, arcwidth - 3, arcwidth - 3, 270, 90);
-
- // graphics.drawArc(tempRect.x+borderwidth,
- // tempRect.y+borderwidth+tempRect.height-arcwidth,
- // arcwidth, arcwidth, 220, 50);
- graphics.drawArc(tempRect.x + borderwidth, tempRect.y + borderwidth + tempRect.height - arcwidth, arcwidth - 1, arcwidth - 1, 230, 40);
- // graphics.drawArc(tempRect.x+borderwidth,
- // tempRect.y+borderwidth+tempRect.height-arcwidth,
- // arcwidth-2, arcwidth-2, 240, 20);
-
- graphics.fillRectangle(tempRect.x + tempRect.width + 1, tempRect.y + arcwidth - 2 * borderwidth - 4, borderwidth, tempRect.height - arcwidth + borderwidth);
- graphics.fillRectangle(tempRect.x + arcwidth - 2 * borderwidth - 4, tempRect.y + tempRect.height + 1, tempRect.width - arcwidth + borderwidth, borderwidth);
-
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/StateFigure.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/StateFigure.java
deleted file mode 100644
index 2132f427d07..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/StateFigure.java
+++ /dev/null
@@ -1,244 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.figures;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.notation.GradientStyle;
-import org.eclipse.papyrus.diagram.common.figure.node.AutomaticCompartmentLayoutManager;
-import org.eclipse.papyrus.diagram.common.figure.node.CompartmentFigure;
-import org.eclipse.swt.SWT;
-
-/**
- * Represents a classifier.
- */
-public class StateFigure extends CompartmentFigure {
-
- int arcwidth = 20;
-
- /**
- * The information label.
- */
- protected WrappingLabel informationLabel;
-
- protected boolean informationHasChanged = false;
-
- protected boolean isInformationShown = false;
-
- protected String submachineStateName = "";
-
- protected boolean isSubmachineState = false;
-
- /** The State Compartment */
- private final static String STATE_COMPARTMENT = "stateCompartment";
-
- /** The List of Compartment */
- private final static List<String> COMPARTMENT = new ArrayList<String>() {
-
- private static final long serialVersionUID = 1L;
- {
- add(STATE_COMPARTMENT);
- }
- };
-
- /**
- * Default Constructor
- */
- public StateFigure() {
- this(null);
- }
-
- /**
- * Create a new StateMachine figure with the given tag
- *
- * @param tagLabel
- * a String that will be displayed at the top of the figure
- */
- public StateFigure(String tagLabel) {
- super(COMPARTMENT, tagLabel);
- shadowborder = new RoundedShadowBorder(getForegroundColor());
- setBorder(shadowborder);
- ((AutomaticCompartmentLayoutManager)getLayoutManager()).setAddExtraHeight(false);
- }
-
- /**
- * Create a label that contains the name of the element.
- */
- protected void createInformationLabel() {
- informationLabel = new WrappingLabel();
-
- informationLabel.setOpaque(false);
- informationLabel.setAlignment(PositionConstants.MIDDLE);
- informationLabel.setVisible(false);
- informationLabel.setTextWrap(true);
- getInformationLabelContainer().add(informationLabel, getInformationLabelConstraint(), -1);
- }
-
- public void setSubmachineStateName(String text) {
- submachineStateName = text;
- }
-
- public void setIsSubmachineState(boolean b) {
- isSubmachineState = b;
- }
-
-
- protected void refreshName() {
- if(isSubmachineState) {
- nameLabel.setText(submachineStateName);
- }
- }
-
- @Override
- protected void createNameLabel() {
- // TODO Auto-generated method stub
- super.createNameLabel();
-
- createInformationLabel();
- }
-
- public void fillInformation(String text) {
- if(!informationLabel.getText().equals(text)) {
- informationLabel.setText(text);
- informationHasChanged = true;
- refreshInformationToShow();
- } else
- informationHasChanged = false;
- }
-
- public WrappingLabel getInformationLabel() {
- return informationLabel;
- }
-
- /**
- * Get the constraint for adding the information label.
- * Children should override and implement this method in case the label must be drawn with a specific constraint.
- *
- * @return figure containing the name label
- * @see #getInformationLabelContainer()
- * @see #getDefaultLabelsConstraint()
- */
- protected Object getInformationLabelConstraint() {
- return getDefaultLabelsConstraint();
- }
-
- /**
- * Get the container for the information label.
- * Children should override and implement this method in case the label must not be drawn in the overall figure. The returned figure shall be
- * created in the method {@link #createCompositeFigureStructure()}.
- *
- * @return figure containing the name label
- * @see #getDefaultLabelsContainer()
- */
- protected IFigure getInformationLabelContainer() {
- return getDefaultLabelsContainer();
- }
-
- /**
- * Get the state compartment figure
- *
- * @return
- */
- public RectangleFigure getStateCompartmentFigure() {
- return getCompartment(STATE_COMPARTMENT);
- }
-
- public boolean hasInformationChanged() {
- return informationHasChanged;
- }
-
- @Override
- protected void paintBackground(Graphics graphics, Rectangle rectangle) {
- if(isUsingGradient()) {
- applyTransparency(graphics);
- boolean isVertical = (getGradientStyle() == GradientStyle.VERTICAL) ? true : false;
- if(isVertical && rectangle.height > ((3 * arcwidth) / 2)) {
- Rectangle rect1 = new Rectangle(rectangle.getLocation(), new Dimension(rectangle.width, arcwidth));
- Rectangle rect2 = new Rectangle(rectangle.x, rectangle.y + rectangle.height - arcwidth, rectangle.width, arcwidth);;
- graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor2()));
- graphics.fillRoundRectangle(rect1, arcwidth, arcwidth);
- graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1()));
- graphics.fillRoundRectangle(rect2, arcwidth, arcwidth);
-
-
- graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1()));
- graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2()));
- Rectangle rect = new Rectangle(rectangle.x, rectangle.y + arcwidth / 2, rectangle.width, rectangle.height - arcwidth);
- graphics.fillGradient(rect, true);
- } else if(!isVertical && rectangle.width > ((3 * arcwidth) / 2)) {
- Rectangle rect1 = new Rectangle(rectangle.getLocation(), new Dimension(arcwidth, rectangle.height));
- Rectangle rect2 = new Rectangle(rectangle.x + rectangle.width - arcwidth, rectangle.y, arcwidth, rectangle.height);
- graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor2()));
- graphics.fillRoundRectangle(rect1, arcwidth, arcwidth);
- graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1()));
- graphics.fillRoundRectangle(rect2, arcwidth, arcwidth);
-
-
- graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1()));
- graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2()));
- Rectangle rect = new Rectangle(rectangle.x + arcwidth / 2, rectangle.y, rectangle.width - arcwidth, rectangle.height);
- graphics.fillGradient(rect, false);
- } else {
- graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1()));
- graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2()));
- graphics.fillRoundRectangle(rectangle, arcwidth, arcwidth);
- }
- } else {
- graphics.setBackgroundColor(getBackgroundColor());
- graphics.setForegroundColor(getForegroundColor());
- graphics.fillRoundRectangle(rectangle, arcwidth, arcwidth);
- }
- }
-
- @Override
- public void paintFigure(Graphics graphics) {
- paintBackground(graphics, getBounds());
-
- refreshInformationToShow();
-
- refreshName();
-
- if(isInformationShown) {
- Rectangle rect = informationLabel.getBounds();
- Rectangle rect2 = nameLabel.getBounds();
-
- graphics.setForegroundColor(getBorderColor());
- graphics.setLineStyle(SWT.BORDER_SOLID);
- graphics.setLineWidth(SWT.BOLD);
-
- graphics.drawLine(rect.x - 2, rect.y, rect.x + rect.width - 1, rect.y);
-
- }
- }
-
-
- /**
- * Refreshes the status of the label that displays information, depending on the text to display
- */
- protected void refreshInformationToShow() {
- String text = informationLabel.getText();
- if(text == null || text.length() == 0 || text.equalsIgnoreCase("\n")) {
- informationLabel.setVisible(false);
- isInformationShown = false;
- } else {
- informationLabel.setVisible(true);
- isInformationShown = true;
- }
- }
-
- @Override
- public void setShadow(boolean shadow) {
- super.setShadow(shadow);
- if(!shadow) {
- RoundedBorder bord = new RoundedBorder(arcwidth, arcwidth);
- this.setBorder(bord);
- }
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/StateMachineFigure.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/StateMachineFigure.java
deleted file mode 100644
index 53945aa4991..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/StateMachineFigure.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.figures;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
-import org.eclipse.gmf.runtime.notation.GradientStyle;
-import org.eclipse.papyrus.diagram.common.figure.node.AutomaticCompartmentLayoutManager;
-import org.eclipse.papyrus.diagram.common.figure.node.CompartmentFigure;
-
-/**
- * Represents a classifier.
- */
-public class StateMachineFigure extends CompartmentFigure {
-
- int arcwidth = 20;
-
- /** The StateMachine Compartment */
- private final static String STATEMACHINE_COMPARTMENT = "stateMachineCompartment";
-
- /** The List of Compartment */
- private final static List<String> COMPARTMENT = new ArrayList<String>() {
-
- private static final long serialVersionUID = 1L;
- {
- add(STATEMACHINE_COMPARTMENT);
- }
- };
-
- /**
- * Default Constructor
- */
- public StateMachineFigure() {
- this(null);
- }
-
- /**
- * Create a new StateMachine figure with the given tag
- *
- * @param tagLabel
- * a String that will be displayed at the top of the figure
- */
- public StateMachineFigure(String tagLabel) {
- super(COMPARTMENT, tagLabel);
- shadowborder = new RoundedShadowBorder(getForegroundColor());
- setBorder(shadowborder);
- ((AutomaticCompartmentLayoutManager)getLayoutManager()).setAddExtraHeight(false);
- }
-
- /**
- * Get the statemachine compartment figure
- *
- * @return
- */
- public RectangleFigure getStateMachineCompartmentFigure() {
- return getCompartment(STATEMACHINE_COMPARTMENT);
- }
-
- @Override
- protected void paintBackground(Graphics graphics, Rectangle rectangle) {
- if(isUsingGradient()) {
- applyTransparency(graphics);
- boolean isVertical = (getGradientStyle() == GradientStyle.VERTICAL) ? true : false;
- if(isVertical && rectangle.height > ((3 * arcwidth) / 2)) {
- Rectangle rect1 = new Rectangle(rectangle.getLocation(), new Dimension(rectangle.width, arcwidth));
- Rectangle rect2 = new Rectangle(rectangle.x, rectangle.y + rectangle.height - arcwidth, rectangle.width, arcwidth);;
- graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor2()));
- graphics.fillRoundRectangle(rect1, arcwidth, arcwidth);
- graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1()));
- graphics.fillRoundRectangle(rect2, arcwidth, arcwidth);
-
-
- graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1()));
- graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2()));
- Rectangle rect = new Rectangle(rectangle.x, rectangle.y + arcwidth / 2, rectangle.width, rectangle.height - arcwidth);
- graphics.fillGradient(rect, true);
- } else if(!isVertical && rectangle.width > ((3 * arcwidth) / 2)) {
- Rectangle rect1 = new Rectangle(rectangle.getLocation(), new Dimension(arcwidth, rectangle.height));
- Rectangle rect2 = new Rectangle(rectangle.x + rectangle.width - arcwidth, rectangle.y, arcwidth, rectangle.height);
- graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor2()));
- graphics.fillRoundRectangle(rect1, arcwidth, arcwidth);
- graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1()));
- graphics.fillRoundRectangle(rect2, arcwidth, arcwidth);
-
-
- graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1()));
- graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2()));
- Rectangle rect = new Rectangle(rectangle.x + arcwidth / 2, rectangle.y, rectangle.width - arcwidth, rectangle.height);
- graphics.fillGradient(rect, false);
- } else {
- graphics.setBackgroundColor(FigureUtilities.integerToColor(getGradientColor1()));
- graphics.setForegroundColor(FigureUtilities.integerToColor(getGradientColor2()));
- graphics.fillRoundRectangle(rectangle, arcwidth, arcwidth);
- }
- } else {
- graphics.setBackgroundColor(getBackgroundColor());
- graphics.setForegroundColor(getForegroundColor());
- graphics.fillRoundRectangle(rectangle, arcwidth, arcwidth);
- }
- }
-
- @Override
- public void paintFigure(Graphics graphics) {
- paintBackground(graphics, getBounds());
-
- shadowborder.setColor(getForegroundColor());
- }
-
- @Override
- public void setShadow(boolean shadow) {
- super.setShadow(shadow);
- if(!shadow) {
- RoundedBorder bord = new RoundedBorder(arcwidth, arcwidth);
- this.setBorder(bord);
- }
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/TransitionFigure.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/TransitionFigure.java
deleted file mode 100644
index 40b4e30eb14..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/figures/TransitionFigure.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.PolylineDecoration;
-import org.eclipse.papyrus.diagram.common.figure.edge.DashedEdgeFigure;
-
-public class TransitionFigure extends DashedEdgeFigure {
-
- /**
- * use to if the arrow will be displayed
- */
- protected boolean arrow = true;
-
- /**
- * Creates a new UMLEdgeFigure.
- */
- public TransitionFigure() {
- super();
- setStyle();
- }
-
- /**
- * Sets initial Style for the figure. It does not give any special Color for
- * Background and Foreground. This is the style used for classic arrows:
- * ------>
- */
- protected void setStyle() {
- PolylineDecoration dec = new PolylineDecoration();
- dec.setScale(15, 5);
- dec.setLineWidth(1);
- if(arrow) {
- this.setTargetDecoration(dec);
- } else {
- this.setTargetDecoration(null);
- }// arrow at target endpoint
- this.setLineStyle(Graphics.LINE_CUSTOM); // line drawing style
-
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/helpers/StateMachineLinkMappingHelper.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/helpers/StateMachineLinkMappingHelper.java
deleted file mode 100644
index 968f9ffa95d..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/helpers/StateMachineLinkMappingHelper.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.helpers;
-
-import java.util.Collection;
-
-import org.eclipse.papyrus.diagram.common.helper.ILinkMappingHelper;
-import org.eclipse.uml2.uml.Element;
-
-/**
- * The StateMAchineLinkMappingHelper is specialization of the link mapping
- * helper for the StateMachine diagram
- */
-
-public class StateMachineLinkMappingHelper implements ILinkMappingHelper {
-
- /**
- * SingletonHolder is loaded at the first execution of getInstance() method
- */
- private static class SingletonHolder {
-
- private final static StateMachineLinkMappingHelper instance = new StateMachineLinkMappingHelper();
- }
-
- /**
- * Gets the single instance of StateMachineLinkMappingHelper.
- *
- * @return single instance of StateMachineLinkMappingHelper
- */
- public static StateMachineLinkMappingHelper getInstance() {
- return SingletonHolder.instance;
- }
-
- /**
- * private constructor
- */
- private StateMachineLinkMappingHelper() {
- // do nothing
- }
-
- public Collection<?> getSource(Element link) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Collection<?> getTarget(Element link) {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/helpers/Zone.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/helpers/Zone.java
deleted file mode 100644
index 90e30e11ff5..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/helpers/Zone.java
+++ /dev/null
@@ -1,1020 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.helpers;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EcoreFactory;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-
-/**
- * Helper class used to manage the encoding of a region position within a state
- * machine or a state.
- *
- * @author David Servat
- */
-public class Zone {
-
- public final static int defaultWidth = 200;
-
- public final static int defaultHeight = 100;
-
- public final static int defaultHeader = 13;
-
- /**
- * Key string for EAnnotation
- */
- public static final String ANNOTATION_KEY = "RegionAnnotationKey";
-
- /**
- * Key string for zone entry in EAnnotation
- */
- public static final String ZONE_KEY = "RegionZoneKey";
-
- /**
- * A default empty property string which serves when creating a region
- * without initial graphical context.
- */
- public static final String NONE = "";
-
- /**
- * The code for a region in the TOP part of a given area.
- */
- public static final String TOP = "T";
-
- /**
- * The code for a region in the RIGHT part of a given area.
- */
- public static final String RIGHT = "R";
-
- /**
- * The code for a region in the BOTTOM part of a given area.
- */
- public static final String BOTTOM = "B";
-
- /**
- * The code for a region in the LEFT part of a given area.
- */
- public static final String LEFT = "L";
-
- /**
- * Returns a copy of the property string.
- *
- * @param s
- * a string
- *
- * @return a copy of string s
- */
- public static String copy(String s) {
- return new String(s);
- }
-
- /**
- * Helper to copy zone
- */
- public static void copyZone(View from, View to) {
- if(to.getEAnnotation(ANNOTATION_KEY) == null)
- throw new IllegalArgumentException();
-
- if(!to.getEAnnotation(ANNOTATION_KEY).getDetails().containsKey(ZONE_KEY))
- throw new IllegalArgumentException();
-
- String zone = copy(getZone(from));
- to.getEAnnotation(ANNOTATION_KEY).getDetails().put(ZONE_KEY, zone);
- }
-
- /**
- * Helper to create an initialized Annotation
- */
- public static void createRegionDefaultAnnotation(View region) {
- if(!isRegion(region))
- throw new IllegalArgumentException();
-
- // now everything is fine we can go on
- // the given node is a region node
- // create EAnnotation to store region specifics
- EAnnotation eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
- // register annotation to region node
- eAnnotation.setEModelElement(region);
- eAnnotation.setSource(ANNOTATION_KEY);
-
- // assign default values for zone property
- eAnnotation.getDetails().put(ZONE_KEY, NONE);
- }
-
- /**
- * Computes a bit-wise operation which account for the directions along
- * which a region may be resized. E.g. if a region has no LEFT neighbours -
- * sits directly at the LEFT border of a state machine - we do not allow for
- * a resize along the WEST direction, user will have to resize the state
- * machine or state directly. Bit-wise operations are performed according to
- * the draw2D conventions
- *
- * @param s
- * a string
- *
- * @return an integer which is the result of a bit-wise operation
- */
- public static int getAllowedResizeDirections(String s) {
- if(s == null)
- throw new IllegalArgumentException();
- // this involves bit-wise operations
- // we start with none directions allowed
- // then add others
- int direction = PositionConstants.NONE;
- if(hasLeftNeighbours(s))
- // WEST allowed
- direction |= PositionConstants.WEST;
- if(hasRightNeighbours(s))
- // EAST allowed
- direction |= PositionConstants.EAST;
- if(hasTopNeighbours(s))
- // NORTH allowed
- direction |= PositionConstants.NORTH;
- if(hasBottomNeighbours(s))
- // SOUTH allowed
- direction |= PositionConstants.SOUTH;
- return direction;
- }
-
- /**
- * Helper to get bounds.
- *
- * @param view
- * the region view
- *
- * @return a new Rectangle with same bounds as the region
- */
- public static Rectangle getBounds(View view) {
- int x = (Integer)ViewUtil.getStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLocation_X());
- int y = (Integer)ViewUtil.getStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLocation_Y());
- int width = (Integer)ViewUtil.getStructuralFeatureValue(view, NotationPackage.eINSTANCE.getSize_Width());
- int height = (Integer)ViewUtil.getStructuralFeatureValue(view, NotationPackage.eINSTANCE.getSize_Height());
-
- return new Rectangle(x, y, width, height);
- }
-
- /**
- * Helper to get height of the given view
- *
- * @param view
- * the region view
- *
- * @return the height of the region
- */
- public static int getHeight(View view) {
- int height = (Integer)ViewUtil.getStructuralFeatureValue(view, NotationPackage.eINSTANCE.getSize_Height());
- return height;
- }
-
- /**
- * Checks the regions passed in the list w.r.t. to zone criterion expressed
- * as an initial pattern to be matched and a zone not to be found in the
- * final pattern expression and returns a list of regions matching the
- * criterion
- *
- * @param regionList
- * a list of region nodes
- * @param initPattern
- * the initial pattern the region zone must match
- * @param excludingZoneInFinalPattern
- * the type of zone to exclude in the final pattern
- *
- * @return a list of the regions in the list matching the criterion
- */
- public static List<View> getMatchingRegionsFromList(List<View> regionList, String initPattern, String excludingZoneInFinalPattern) {
-
- List<View> matchingRegions = new ArrayList<View>();
- Iterator<View> it = regionList.iterator();
- while(it.hasNext()) {
- View view = it.next();
- // get the zone of current region
- String zone = Zone.getZone(view);
- String zoneLastPart = (zone.length() <= initPattern.length()) ? "" : zone.substring(initPattern.length());
-
- if(zone.startsWith(initPattern) && !zoneLastPart.contains(excludingZoneInFinalPattern))
- matchingRegions.add(view);
- }
-
- return matchingRegions;
- }
-
- /**
- * Provides the list of nodes which are close to the inside of the given
- * region BOTTOM border.
- *
- * @param region
- * the region graph node
- *
- * @return a vector of the neighbouring graph nodes
- */
- public static List<View> getRegionBottomBorderInsideNeighbours(View region) {
- // get the region zone
- String zone = Zone.getZone(region);
- // we are looking for regions that matches the zone of the given region
- // i.e. if region is initPattern+"T"+finalPattern where finalPattern
- // does not contain any
- // "T"
- // a matching region is initPattern+"T"+otherFinalPattern where
- // otherFinalPattern does not
- // contain any "T"
-
- int index = zone.lastIndexOf(Zone.TOP);
- String initPattern = zone.substring(0, index) + Zone.TOP;
- String excludingZoneInFinalPattern = Zone.TOP;
-
- // get the stateMachine compartment
- View stateMachineCompartment = (View)region.eContainer();
- // then the list of regions
- List<View> regionList = (List<View>)stateMachineCompartment.getChildren();
-
- List<View> neighbours = getMatchingRegionsFromList(regionList, initPattern, excludingZoneInFinalPattern);
-
- return neighbours;
- }
-
- /**
- * Provides the list of regions which are close to the outside of the given
- * region BOTTOM border.
- *
- * @param region
- * the region node
- *
- * @return a vector of the neighbouring regions
- */
- public static List<View> getRegionBottomBorderOutsideNeighbours(View region) {
- // get the region zone
- String zone = Zone.getZone(region);
- // we are looking for regions that matches the zone of the given region
- // i.e. if region is initPattern+"T"+finalPattern where finalPattern
- // does not contain any
- // "T"
- // a matching region is initPattern+"B"+otherFinalPattern where
- // otherFinalPattern does not
- // contain any "B"
-
- int index = zone.lastIndexOf(Zone.TOP);
- String initPattern = zone.substring(0, index) + Zone.BOTTOM;
- String excludingZoneInFinalPattern = Zone.BOTTOM;
-
- // get the stateMachine compartment
- View stateMachineCompartment = (View)region.eContainer();
- // then the list of regions
- List<View> regionList = (List<View>)stateMachineCompartment.getChildren();
-
- List<View> neighbours = getMatchingRegionsFromList(regionList, initPattern, excludingZoneInFinalPattern);
-
- return neighbours;
- }
-
- /**
- * Provides the list of nodes which are close to the inside of the given
- * region LEFT border.
- *
- * @param region
- * the region graph node
- *
- * @return a vector of the neighbouring graph nodes
- */
- public static List<View> getRegionLeftBorderInsideNeighbours(View region) {
- // get the region zone
- String zone = Zone.getZone(region);
- // we are looking for regions that matches the zone of the given region
- // i.e. if region is initPattern+"R"+finalPattern where finalPattern
- // does not contain any
- // "R"
- // a matching region is initPattern+"R"+otherFinalPattern where
- // otherFinalPattern does not
- // contain any "R"
-
- int index = zone.lastIndexOf(Zone.RIGHT);
- String initPattern = zone.substring(0, index) + Zone.RIGHT;
- String excludingZoneInFinalPattern = Zone.RIGHT;
-
- // get the stateMachine compartment
- View stateMachineCompartment = (View)region.eContainer();
- // then the list of regions
- List<View> regionList = (List<View>)stateMachineCompartment.getChildren();
-
- List<View> neighbours = getMatchingRegionsFromList(regionList, initPattern, excludingZoneInFinalPattern);
-
- return neighbours;
- }
-
- /**
- * Provides the list of nodes which are close to the outside of the given
- * region LEFT border.
- *
- * @param region
- * the region graph node
- *
- * @return a list of the neighbouring graph nodes
- */
- public static List<View> getRegionLeftBorderOutsideNeighbours(View region) {
- // get the region zone
- String zone = Zone.getZone(region);
- // we are looking for regions that matches the zone of the given region
- // i.e. if region is initPattern+"R"+finalPattern where finalPattern
- // does not contain any
- // "R"
- // a matching region is initPattern+"L"+otherFinalPattern where
- // otherFinalPattern does not
- // contain any "L"
-
- int index = zone.lastIndexOf(Zone.RIGHT);
- String initPattern = zone.substring(0, index) + Zone.LEFT;
- String excludingZoneInFinalPattern = Zone.LEFT;
-
- // get the stateMachine compartment
- View stateMachineCompartment = (View)region.eContainer();
- // then the list of regions
- List<View> regionList = (List<View>)stateMachineCompartment.getChildren();
-
- List<View> neighbours = getMatchingRegionsFromList(regionList, initPattern, excludingZoneInFinalPattern);
-
- return neighbours;
- }
-
- /**
- * Provides the list of nodes which are close ot the inside of the given
- * region RIGHT border.
- *
- * @param region
- * the region graph node
- *
- * @return a vector of the neighbouring graph nodes
- */
- public static List<View> getRegionRightBorderInsideNeighbours(View region) {
- // get the region zone
- String zone = Zone.getZone(region);
- // we are looking for regions that matches the zone of the given region
- // i.e. if region is initPattern+"L"+finalPattern where finalPattern
- // does not contain any
- // "L"
- // a matching region is initPattern+"L"+otherFinalPattern where
- // otherFinalPattern does not
- // contain any "L"
-
- int index = zone.lastIndexOf(Zone.LEFT);
- String initPattern = zone.substring(0, index) + Zone.LEFT;
- String excludingZoneInFinalPattern = Zone.LEFT;
-
- // get the stateMachine compartment
- View stateMachineCompartment = (View)region.eContainer();
- // then the list of regions
- List<View> regionList = (List<View>)stateMachineCompartment.getChildren();
-
- List<View> neighbours = getMatchingRegionsFromList(regionList, initPattern, excludingZoneInFinalPattern);
-
- return neighbours;
- }
-
- /**
- * Provides the list of nodes which are at the outside of the given region
- * RIGHT border.
- *
- * @param region
- * the region graph node
- *
- * @return a vector of the neighbouring graph nodes
- */
- public static List<View> getRegionRightBorderOutsideNeighbours(View region) {
- // get the region zone
- String zone = Zone.getZone(region);
- // we are looking for regions that matches the zone of the given region
- // i.e. if region is initPattern+"L"+finalPattern where finalPattern
- // does not contain any
- // "L"
- // a matching region is initPattern+"R"+otherFinalPattern where
- // otherFinalPattern does not
- // contain any "R"
-
- int index = zone.lastIndexOf(Zone.LEFT);
- String initPattern = zone.substring(0, index) + Zone.RIGHT;
- String excludingZoneInFinalPattern = Zone.RIGHT;
-
- // get the stateMachine compartment
- View stateMachineCompartment = (View)region.eContainer();
- // then the list of regions
- List<View> regionList = (List<View>)stateMachineCompartment.getChildren();
-
- List<View> neighbours = getMatchingRegionsFromList(regionList, initPattern, excludingZoneInFinalPattern);
-
- return neighbours;
- }
-
- /**
- * Provides the list of nodes which are close to the inside of the given
- * region TOP border.
- *
- * @param region
- * the region node
- *
- * @return a vector of the neighbouring regions
- */
- public static List<View> getRegionTopBorderInsideNeighbours(View region) {
- // get the region zone
- String zone = Zone.getZone(region);
- // we are looking for regions that matches the zone of the given region
- // i.e. if region is initPattern+"B"+finalPattern where finalPattern
- // does not contain any
- // "B"
- // a matching region is initPattern+"B"+otherFinalPattern where
- // otherFinalPattern does not
- // contain any "B"
-
- int index = zone.lastIndexOf(Zone.BOTTOM);
- String initPattern = zone.substring(0, index) + Zone.BOTTOM;
- String excludingZoneInFinalPattern = Zone.BOTTOM;
-
- // get the stateMachine compartment
- View stateMachineCompartment = (View)region.eContainer();
- // then the list of regions
- List<View> regionList = (List<View>)stateMachineCompartment.getChildren();
-
- List<View> neighbours = getMatchingRegionsFromList(regionList, initPattern, excludingZoneInFinalPattern);
-
- return neighbours;
- }
-
- /**
- * Provides the list of nodes which are close to the outside of the given
- * region TOP border.
- *
- * @param region
- * the region graph node
- *
- * @return a vector of the neighbouring graph nodes
- */
- public static List<View> getRegionTopBorderOutsideNeighbours(View region) {
- // get the region zone
- String zone = Zone.getZone(region);
- // we are looking for regions that matches the zone of the given region
- // i.e. if region is initPattern+"B"+finalPattern where finalPattern
- // does not contain any
- // "B"
- // a matching region is initPattern+"T"+otherFinalPattern where
- // otherFinalPattern does not
- // contain any "T"
-
- int index = zone.lastIndexOf(Zone.BOTTOM);
- String initPattern = zone.substring(0, index) + Zone.TOP;
- String excludingZoneInFinalPattern = Zone.TOP;
-
- // get the stateMachine compartment
- View stateMachineCompartment = (View)region.eContainer();
- // then the list of regions
- List<View> regionList = (List<View>)stateMachineCompartment.getChildren();
-
- List<View> neighbours = getMatchingRegionsFromList(regionList, initPattern, excludingZoneInFinalPattern);
-
- return neighbours;
- }
-
- /**
- * Helper to get width
- *
- * @param region
- * the region graph node
- *
- * @return the width of the region
- */
- public static int getWidth(View view) {
- int width = (Integer)ViewUtil.getStructuralFeatureValue(view, NotationPackage.eINSTANCE.getSize_Width());
- return width;
- }
-
- /**
- * Helper to get x
- *
- * @param region
- * the region graph node
- *
- * @return the x of the region
- */
- public static int getX(View view) {
- int x = (Integer)ViewUtil.getStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLocation_X());
- return x;
- }
-
- /**
- * Helper to get y
- *
- * @param region
- * the region graph node
- *
- * @return the y of the region
- */
- public static int getY(View view) {
- int y = (Integer)ViewUtil.getStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLocation_Y());
- return y;
- }
-
- /**
- * Helper to access zone
- *
- * @param region
- * the region graph node
- *
- * @return the zone of the region
- */
- public static String getZone(View view) {
- if(view.getEAnnotation(ANNOTATION_KEY) == null)
- throw new IllegalArgumentException();
- if(!view.getEAnnotation(ANNOTATION_KEY).getDetails().containsKey(ZONE_KEY))
- throw new IllegalArgumentException();
- return view.getEAnnotation(ANNOTATION_KEY).getDetails().get(ZONE_KEY);
- }
-
- /**
- * Returns the zone counterpart of the given zone i.e. if Zone.RIGHT then
- * Zone.LEFT is returned, etc.
- *
- * @param zone
- * the zone
- *
- * @return the counterpart zone
- */
- private static String getZoneCounterpart(String s) {
- String cs = s.substring(0, s.length() - 1);
- if(Zone.isRight(s))
- return Zone.setLeft(cs);
- if(Zone.isLeft(s))
- return Zone.setRight(cs);
- if(Zone.isBottom(s))
- return Zone.setTop(cs);
- if(Zone.isTop(s))
- return Zone.setBottom(cs);
- return s;
- }
-
- /**
- * Computes the zone at location within bounds using absolute coordinates
- *
- * @param location
- * the location
- * @param rect
- * the bounds
- *
- * @return the zone
- */
- public static String getZoneFromLocationInRectangleWithAbsoluteCoordinates(Point location, Rectangle rect) {
- // d1 is for the first diagonal (going up) rect
- double d1 = location.y - 1.0 * rect.height / rect.width * (rect.x - location.x) - rect.y - rect.height;
- // d2 is for the second (going down)
- double d2 = location.y + 1.0 * rect.height / rect.width * (rect.x - location.x) - rect.y;
- if((d1 <= 0) && (d2 <= 0)) {
- return Zone.TOP;
- }
- if((d1 <= 0) && (d2 > 0)) {
- return Zone.LEFT;
- }
- if((d1 > 0) && (d2 <= 0)) {
- return Zone.RIGHT;
- }
- if((d1 > 0) && (d2 > 0)) {
- return Zone.BOTTOM;
- }
- return Zone.NONE;
- }
-
- /**
- * Computes the zone at location within bounds using local coordinates
- *
- * @param location
- * the location
- * @param rect
- * the bounds
- *
- * @return the zone
- */
- public static String getZoneFromLocationInRectangleWithLocalCoordinates(Point location, Rectangle rect) {
- // d1 is for the first diagonal (going up) rect
- double d1 = location.y + 1.0 * rect.height * location.x / rect.width - rect.height;
- // d2 is for the second (going down)
- double d2 = location.y - 1.0 * rect.height * location.x / rect.width;
- if((d1 <= 0) && (d2 <= 0)) {
- return Zone.TOP;
- }
- if((d1 <= 0) && (d2 > 0)) {
- return Zone.LEFT;
- }
- if((d1 > 0) && (d2 <= 0)) {
- return Zone.RIGHT;
- }
- if((d1 > 0) && (d2 > 0)) {
- return Zone.BOTTOM;
- }
- return Zone.NONE;
- }
-
- /**
- * Checks whether the given location has any BOTTOM neighbours. Or said
- * differently has a BOTTOM border.
- *
- * @param s
- * a string
- *
- * @return boolean true or false
- */
- public static boolean hasBottomNeighbours(String s) {
- if(s == null)
- throw new IllegalArgumentException();
- return s.contains(Zone.TOP);
- }
-
- /**
- * Checks whether the given location has any LEFT neighbours. Or said
- * differently has a LEFT border.
- *
- * @param s
- * a string
- *
- * @return boolean true or false
- */
- public static boolean hasLeftNeighbours(String s) {
- if(s == null)
- throw new IllegalArgumentException();
- return s.contains(Zone.RIGHT);
- }
-
- /**
- * Checks whether the given location has any RIGHT neighbours. Or said
- * differently has a RIGHT border.
- *
- * @param s
- * a string
- *
- * @return boolean true or false
- */
- public static boolean hasRightNeighbours(String s) {
- if(s == null)
- throw new IllegalArgumentException();
- return s.contains(Zone.LEFT);
- }
-
- /**
- * Checks whether the given location has any TOP neighbours. Or said
- * differently has a TOP border.
- *
- * @param s
- * a string
- *
- * @return boolean true or false
- */
- public static boolean hasTopNeighbours(String s) {
- if(s == null)
- throw new IllegalArgumentException();
- return s.contains(Zone.BOTTOM);
- }
-
- /**
- * Checks whether the leaf location encoded is BOTTOM.
- *
- * @param s
- * a string
- *
- * @return boolean true or false
- */
- public static boolean isBottom(String s) {
- if(s == null)
- throw new IllegalArgumentException();
- return s.endsWith(Zone.BOTTOM);
- }
-
- /**
- * Checks whether the leaf location encoded is LEFT.
- *
- * @param s
- * a string
- *
- * @return boolean true or false
- */
- public static boolean isLeft(String s) {
- if(s == null)
- throw new IllegalArgumentException();
- return s.endsWith(Zone.LEFT);
- }
-
- /**
- * Checks whether the leaf location encoded is NONE.
- *
- * @param s
- * a string
- * @return boolean true or false
- */
- public static boolean isNone(String s) {
- if(s == null)
- throw new IllegalArgumentException();
- return s.equals(Zone.NONE);
- }
-
- /**
- * Checks whether the view is a region
- *
- * @param view
- * a View
- * @return boolean true or false
- */
- public static boolean isRegion(View view) {
- if(view == null)
- throw new IllegalArgumentException();
- return (UMLVisualIDRegistry.getVisualID(view.getType()) == RegionEditPart.VISUAL_ID);
- }
-
- /**
- * Checks whether the leaf location encoded is RIGHT.
- *
- * @param s
- * a string
- *
- * @return boolean true or false
- */
- public static boolean isRight(String s) {
- if(s == null)
- throw new IllegalArgumentException();
- return s.endsWith(Zone.RIGHT);
- }
-
- /**
- * Checks whether the view is a state machine
- *
- * @param view
- * a View
- * @return boolean true or false
- */
- public static boolean isStateMachine(View view) {
- if(view == null)
- throw new IllegalArgumentException();
- return (UMLVisualIDRegistry.getVisualID(view.getType()) == StateMachineEditPart.VISUAL_ID);
- }
-
- /**
- * Checks whether the leaf location encoded is TOP.
- *
- * @param s
- * a string
- * @return boolean true or false
- */
- public static boolean isTop(String s) {
- if(s == null)
- throw new IllegalArgumentException();
- return s.endsWith(Zone.TOP);
- }
-
- /**
- * Resets the zone of the region counterparts i.e. if region passed has a
- * "XXXR" zone then its counterparts are "XXXL*", etc. Resetting their zones
- * mean they are changed into "XXX*" "L" is removed
- *
- * @param region
- * the region node
- */
- public static void resetRegionCounterpartZone(View region) {
- // get the region zone
- String zone = getZone(region);
- // get its counterpart
- String cZone = getZoneCounterpart(zone);
-
- List<View> list = new ArrayList<View>();
- // get the stateMachine compartment
- View stateMachineCompartment = (View)region.eContainer();
- Iterator<View> it = stateMachineCompartment.getChildren().iterator();
- while(it.hasNext()) {
- View view = it.next();
- String currentZone = getZone(view);
- if(currentZone.startsWith(cZone)) {
- String initPart = currentZone.substring(0, cZone.length() - 1);
- String finalPart = (currentZone.length() <= cZone.length()) ? "" : currentZone.substring(cZone.length());
- currentZone = initPart + finalPart;
- setZone(view, currentZone);
- }
- }
- }
-
- /**
- * Adds a final "B" to the given property string. This is used when a
- * horizontal region is created. The new region is always at the BOTTOM, the
- * old one is on TOP.
- *
- * @param s
- * a string
- *
- * @return the updated string
- */
- public static String setBottom(String s) {
- if(s == null)
- throw new IllegalArgumentException();
- return s + Zone.BOTTOM;
- }
-
- /**
- * Helper to set zone
- *
- * @param view
- * a View
- */
- public static void setBottom(View view) {
- if(view.getEAnnotation(ANNOTATION_KEY) == null)
- throw new IllegalArgumentException();
-
- if(!view.getEAnnotation(ANNOTATION_KEY).getDetails().containsKey(ZONE_KEY))
- throw new IllegalArgumentException();
-
- String currentZone = Zone.getZone(view);
- String zoneToSet = Zone.setBottom(currentZone);
- view.getEAnnotation(ANNOTATION_KEY).getDetails().put(ZONE_KEY, zoneToSet);
- }
-
- /**
- * Helper to set bounds
- *
- * @param view
- * a View
- * @param bounds
- * the bounds
- */
- public static void setBounds(View view, Rectangle bounds) {
- ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLocation_X(), bounds.x);
- ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLocation_Y(), bounds.y);
- ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getSize_Width(), bounds.width);
- ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getSize_Height(), bounds.height);
- }
-
- /**
- * Helper to set height
- *
- * @param view
- * a View
- * @param height
- * the height
- */
- public static void setHeight(View view, int height) {
- ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getSize_Height(), height);
- }
-
- /**
- * Adds a final "L" to the given property string. This is used when a
- * vertical region is created. The new region is always on the RIGHT, the
- * old one is on the LEFT.
- *
- * @param s
- * a string
- *
- * @return the updated string
- */
- public static String setLeft(String s) {
- if(s == null)
- throw new IllegalArgumentException();
- return s + Zone.LEFT;
- }
-
- /**
- * Helper to set zone
- *
- * @param view
- * a View
- */
- public static void setLeft(View view) {
- if(view.getEAnnotation(ANNOTATION_KEY) == null)
- throw new IllegalArgumentException();
-
- if(!view.getEAnnotation(ANNOTATION_KEY).getDetails().containsKey(ZONE_KEY))
- throw new IllegalArgumentException();
-
- String currentZone = Zone.getZone(view);
- String zoneToSet = Zone.setLeft(currentZone);
- view.getEAnnotation(ANNOTATION_KEY).getDetails().put(ZONE_KEY, zoneToSet);
- }
-
- /**
- * Adds a final "R" to the given property string. This is used when a
- * vertical region is created. The new region is always on the RIGHT, the
- * old one is on the LEFT.
- *
- * @param s
- * a string
- *
- * @return the updated string
- */
- public static String setRight(String s) {
- if(s == null)
- throw new IllegalArgumentException();
- return s + Zone.RIGHT;
- }
-
- /**
- * Helper to set zone
- *
- * @param view
- * a View
- */
- public static void setRight(View view) {
- if(view.getEAnnotation(ANNOTATION_KEY) == null)
- throw new IllegalArgumentException();
-
- if(!view.getEAnnotation(ANNOTATION_KEY).getDetails().containsKey(ZONE_KEY))
- throw new IllegalArgumentException();
-
- String currentZone = Zone.getZone(view);
- String zoneToSet = Zone.setRight(currentZone);
- view.getEAnnotation(ANNOTATION_KEY).getDetails().put(ZONE_KEY, zoneToSet);
- }
-
- /**
- * Adds a final "T" to the given property string. This is used when a
- * horizontal region is created. The new region is always at the BOTTOM, the
- * old one is on TOP.
- *
- * @param s
- * a string
- *
- * @return the updated string
- */
- public static String setTop(String s) {
- if(s == null)
- throw new IllegalArgumentException();
- return s + Zone.TOP;
- }
-
- /**
- * Helper to set zone
- *
- * @param view
- * a View
- */
- public static void setTop(View view) {
- if(view.getEAnnotation(ANNOTATION_KEY) == null)
- throw new IllegalArgumentException();
-
- if(!view.getEAnnotation(ANNOTATION_KEY).getDetails().containsKey(ZONE_KEY))
- throw new IllegalArgumentException();
-
- String currentZone = Zone.getZone(view);
- String zoneToSet = Zone.setTop(currentZone);
- view.getEAnnotation(ANNOTATION_KEY).getDetails().put(ZONE_KEY, zoneToSet);
- }
-
- /**
- * Helper to set width
- *
- * @param view
- * a View
- * @param width
- * the width
- */
- public static void setWidth(View view, int width) {
- ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getSize_Width(), width);
- }
-
- /**
- * Helper to set x
- *
- * @param view
- * a View
- * @param x
- * the x
- */
- public static void setX(View view, int x) {
- ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLocation_X(), x);
- }
-
- /**
- * Helper to set y
- *
- * @param view
- * a View
- * @param y
- * the y
- */
- public static void setY(View view, int y) {
- ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLocation_Y(), y);
- }
-
- /**
- * Helper to set zone with passed zone
- *
- * @param view
- * a View
- * @param zone
- * a Zone
- */
- public static void setZone(View view, String zone) {
- if(view.getEAnnotation(ANNOTATION_KEY) == null)
- throw new IllegalArgumentException();
-
- if(!view.getEAnnotation(ANNOTATION_KEY).getDetails().containsKey(ZONE_KEY))
- throw new IllegalArgumentException();
-
- view.getEAnnotation(ANNOTATION_KEY).getDetails().put(ZONE_KEY, zone);
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/listeners/DropTargetListener.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/listeners/DropTargetListener.java
deleted file mode 100644
index dc9281c54fb..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/listeners/DropTargetListener.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Obeo.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.diagram.statemachine.custom.listeners;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramDropTargetListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.dnd.TransferData;
-
-/**
- * This class is used to handle drop event on diagram
- *
- * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a>
- */
-public abstract class DropTargetListener extends DiagramDropTargetListener {
-
- public DropTargetListener(EditPartViewer viewer, Transfer xfer) {
- super(viewer, xfer);
- }
-
- protected abstract Object getJavaObject(TransferData data);
-
- @Override
- protected List<EObject> getObjectsBeingDropped() {
- // get objects from transfer
- TransferData data = getCurrentEvent().currentDataType;
- HashSet<URI> uris = new HashSet<URI>();
-
- Object transferedObject = getJavaObject(data);
- if(transferedObject instanceof IStructuredSelection) {
- IStructuredSelection selection = (IStructuredSelection)transferedObject;
- for(Iterator<?> it = selection.iterator(); it.hasNext();) {
- Object nextSelectedObject = it.next();
- // if (nextSelectedObject instanceof UMLNavigatorItem) {
- // View view = ((UMLNavigatorItem)
- // nextSelectedObject).getView();
- // nextSelectedObject = view.getElement();
- // } else
- if(nextSelectedObject instanceof IAdaptable) {
- IAdaptable adaptable = (IAdaptable)nextSelectedObject;
- nextSelectedObject = adaptable.getAdapter(EObject.class);
- }
- if(nextSelectedObject instanceof EObject) {
- EObject modelElement = (EObject)nextSelectedObject;
- Resource modelElementResource = modelElement.eResource();
- uris.add(modelElementResource.getURI().appendFragment(modelElementResource.getURIFragment(modelElement)));
- // TODO check visualID supported by class diagram
- }
- }
- }
-
- ArrayList<EObject> result = new ArrayList<EObject>();
- for(URI uri : uris) {
- EObject modelObject = getTransactionalEditingDomain().getResourceSet().getEObject(uri, true);
- result.add(modelObject);
- }
- return result;
- }
-
- protected abstract TransactionalEditingDomain getTransactionalEditingDomain();
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/locators/CustomEntryExitPointPositionLocator.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/locators/CustomEntryExitPointPositionLocator.java
deleted file mode 100644
index d3b6658d0e6..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/locators/CustomEntryExitPointPositionLocator.java
+++ /dev/null
@@ -1,194 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.locators;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-
-
-
-/**
- * This class is used to constrain the position of Entry/Exit points when they are added on a StateMachine
- *
- */
-public class CustomEntryExitPointPositionLocator implements IBorderItemLocator {
-
- /** the figure around which this border item appears */
- protected IFigure parentFigure = null;
-
- /** the width of the area surrounding the parent figure where border item can be put */
- protected int borderItemOffset = 10;
-
- /** the position constraint */
- protected Rectangle constraint = new Rectangle(0, 0, 0, 0);
-
- /** Constructor **/
- public CustomEntryExitPointPositionLocator(IFigure parentFigure, int preferredSide) {
- // The preferredSide parameter is not used, just kept here to ensure compatibility
- // with GMF generated code.
- this.parentFigure = parentFigure;
- }
-
- /**
- *
- * @see org.eclipse.gmf.runtime.draw2d.ui.figures.IBorderItemLocator#getCurrentSideOfParent()
- *
- * @return
- * the position of the port around its parent. This position can be
- * <ul>
- * <li>{@linkplain PositionConstants#NORTH}</li>
- * <li> {@linkplain PositionConstants#SOUTH}</li>
- * <li> {@linkplain PositionConstants#EAST}</li>
- * <li> {@linkplain PositionConstants#WEST}</li>
- * <li> {@linkplain PositionConstants#NORTH_EAST}</li>
- * <li> {@linkplain PositionConstants#NORTH_WEST}</li>
- * <li> {@linkplain PositionConstants#SOUTH_EAST}</li>
- * <li> {@linkplain PositionConstants#SOUTH_WEST}</li>
- * </ul>
- */
- public int getCurrentSideOfParent() {
- int position = PositionConstants.NONE;
-
- System.out.println("parentsBounds = " + parentFigure.getBounds());
-
- //we are not on EAST, not on WEST, but we are on the NORTH
- if((constraint.x != parentFigure.getBounds().width - borderItemOffset) && (constraint.x != -this.borderItemOffset) && (constraint.y == -this.borderItemOffset)) {
- position = PositionConstants.NORTH;
-
- //we are not on the EAST and not on the WEST, but we are on the SOUTH
- } else if((constraint.x != parentFigure.getBounds().width - borderItemOffset) && (constraint.x != -this.borderItemOffset) && (constraint.y == parentFigure.getBounds().height - borderItemOffset)) {
- position = PositionConstants.SOUTH;
-
- //we are on the EAST, but we are not on the NORTH and not on the SOUTH
- } else if((constraint.x == parentFigure.getBounds().width - borderItemOffset) && (constraint.y != -this.borderItemOffset) && (constraint.y != parentFigure.getBounds().height - borderItemOffset)) {
- position = PositionConstants.EAST;
-
- //we are on the WEST, but we are not on the on the NORTH and not on the SOUTH
- } else if((constraint.x == -this.borderItemOffset) && (constraint.y != -this.borderItemOffset) && (constraint.y != parentFigure.getBounds().height - borderItemOffset)) {
- position = PositionConstants.WEST;
-
- //we are on the NORTH and on the EAST
- } else if((constraint.x == parentFigure.getBounds().width - borderItemOffset) && (constraint.y == -this.borderItemOffset)) {
- position = PositionConstants.NORTH_EAST;
-
- //we are on the NORTH and on the WEST
- } else if((constraint.x == -this.borderItemOffset) && (constraint.y == -this.borderItemOffset)) {
- position = PositionConstants.NORTH_WEST;
-
- //we are on the EAST and on the SOUTH
- } else if((constraint.x == parentFigure.getBounds().width - borderItemOffset) && (constraint.y == parentFigure.getBounds().height - borderItemOffset)) {
- position = PositionConstants.SOUTH_EAST;
-
- //we are on the WEST and on the SOUTH
- } else if((constraint.x == -this.borderItemOffset) && (constraint.y == parentFigure.getBounds().height - borderItemOffset)) {
- position = PositionConstants.SOUTH_WEST;
- }
-
- return position;
- }
-
- /**
- * get the parent figure
- *
- * @return the parent figure
- */
- public IFigure getParentFigure() {
- return parentFigure;
- }
-
- /**
- *
- * @param proposedLocation
- * the proposed location
- * @return a possible location on parent figure border
- */
- public Rectangle getPreferredLocation(Rectangle proposedLocation) {
-
- // Initialize port location with proposed location
- // and resolve the bounds of it graphical parent
- Rectangle realLocation = new Rectangle(proposedLocation);
-
- Rectangle parentRec = getParentFigure().getBounds().getCopy();
-
- // Calculate Max position around the graphical parent (1/2 size or the port around
- // the graphical parent bounds.
- int xMin = parentRec.x - borderItemOffset;
- int xMax = parentRec.x - borderItemOffset + parentRec.width;
- int yMin = parentRec.y - borderItemOffset;
- int yMax = parentRec.y - borderItemOffset + parentRec.height;
-
- // Modify Port location if MAX X or Y are exceeded
- if(realLocation.x < xMin) {
- realLocation.x = xMin;
- }
-
- if(realLocation.x > xMax) {
- realLocation.x = xMax;
- }
-
- if(realLocation.y < yMin) {
- realLocation.y = yMin;
- }
-
- if(realLocation.y > yMax) {
- realLocation.y = yMax;
- }
-
- // Ensure the port is positioned on its parent borders and not in the middle.
- // Modify position if needed.
- if((realLocation.y != yMin) && (realLocation.y != yMax)) {
- if((realLocation.x != xMin) && (realLocation.x != xMax)) {
-
- if(realLocation.x <= (xMin + (parentRec.width / 2))) {
- realLocation.x = xMin;
- } else {
- realLocation.x = xMax;
- }
- }
- }
-
- // Return constrained location
- return realLocation;
- }
-
- /**
- *
- * @see org.eclipse.gmf.runtime.draw2d.ui.figures.IBorderItemLocator#getValidLocation(org.eclipse.draw2d.geometry.Rectangle,
- * org.eclipse.draw2d.IFigure)
- *
- * @param proposedLocation
- * @param borderItem
- * @return a valid location
- */
- public Rectangle getValidLocation(Rectangle proposedLocation, IFigure borderItem) {
- return getPreferredLocation(proposedLocation);
- }
-
- /**
- *
- * @see org.eclipse.draw2d.Locator#relocate(org.eclipse.draw2d.IFigure)
- *
- * @param target
- */
- public void relocate(IFigure target) {
-
- Rectangle proposedLocation = constraint.getCopy();
- proposedLocation.setLocation(constraint.getLocation().translate(parentFigure.getBounds().getTopLeft()));
-
- Point validLocation = getValidLocation(proposedLocation, target).getLocation();
-
- target.setBounds(new Rectangle(validLocation, target.getPreferredSize()));
- }
-
- /**
- *
- * @see org.eclipse.gmf.runtime.draw2d.ui.figures.IBorderItemLocator#setConstraint(org.eclipse.draw2d.geometry.Rectangle)
- *
- * @param constraint
- */
- public void setConstraint(Rectangle constraint) {
- this.constraint = constraint;
-
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/parsers/TransitionPropertiesParser.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/parsers/TransitionPropertiesParser.java
deleted file mode 100644
index c9732a22b7a..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/parsers/TransitionPropertiesParser.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.parsers;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.papyrus.core.utils.EditorUtils;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Transition;
-import org.eclipse.uml2.uml.UMLFactory;
-
-public class TransitionPropertiesParser implements IParser {
-
- protected Constraint guardConstraint = null;
-
- public IContentAssistProcessor getCompletionProcessor(IAdaptable element) {
- return null;
- }
-
- public String getEditString(IAdaptable element, int flags) {
- if(element instanceof EObjectAdapter) {
- final Transition transition = ((Transition)((EObjectAdapter)element).getRealObject());
- }
- return "";
- }
-
- public ICommand getParseCommand(IAdaptable element, String newString, int flags) {
- final Transition transition = ((Transition)((EObjectAdapter)element).getRealObject());
- final String result = newString;
-
- AbstractTransactionalCommand tc = new AbstractTransactionalCommand(EditorUtils.getTransactionalEditingDomain(), "Edit Transition Properties", (List)null) {
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- SafeRunnable.run(new SafeRunnable() {
-
- public void run() {
- RecordingCommand rc = new RecordingCommand(EditorUtils.getTransactionalEditingDomain()) {
-
- protected void doExecute() {
- // 1. Cherchez dans le model, si une contrainst
- // avec le meme nom existe
-
- EList<Element> elements = (transition.getModel()).allOwnedElements();
- Iterator<Element> modelElement = elements.iterator();
- while(modelElement.hasNext()) {
- Element pElement = (Element)modelElement.next();
- if(pElement instanceof Constraint && (result.equals(((NamedElement)pElement).getName()))) {
- guardConstraint = (Constraint)pElement;
- transition.setGuard(guardConstraint);
- }
- }
-
- // 2.Si aucune constraint n'existe deja
- if(guardConstraint == null) {
- guardConstraint = UMLFactory.eINSTANCE.createConstraint();
- guardConstraint.setName(result);
- guardConstraint.setContext(transition.getNamespace());
- transition.setGuard(guardConstraint);
- }
- // transition.setName(result);
- }
- };
- EditorUtils.getTransactionalEditingDomain().getCommandStack().execute(rc);
- }
- });
- return CommandResult.newOKCommandResult();
-
- };
- };
- return tc;
- }
-
- public String getPrintString(IAdaptable element, int flags) {
- String guardConstraintDisplay = "";
- if(guardConstraint != null) {
- guardConstraintDisplay = "/< " + guardConstraint.getName() + " >";
- guardConstraint = null;
- return guardConstraintDisplay;
- }
- return guardConstraintDisplay;
-
- }
-
- public boolean isAffectingEvent(Object event, int flags) {
- if(event instanceof Notification) {
- int notificationType = ((Notification)event).getEventType();
- if(4 == notificationType) {
- if(((Notification)event).getNewValue() instanceof Constraint)
- guardConstraint = (Constraint)((Notification)event).getNewValue();
- /*
- * EObjectAdapter essaiadapter = null;
- * essaiadapter.setRealObject(((Notification)
- * event).getNotifier()); getPrintString((EObjectAdapter)
- * ((Notification) event).getNotifier(),flags);
- */
-
- }
- }
- return false;
- }
-
- public IParserEditStatus isValidEditString(IAdaptable element, String editString) {
-
- return new ParserEditStatus(org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin.ID, IParserEditStatus.OK, "");
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/parts/RegionCompartmentDiagramUpdater.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/parts/RegionCompartmentDiagramUpdater.java
deleted file mode 100644
index 3fde03f9d5e..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/parts/RegionCompartmentDiagramUpdater.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.parts;
-
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.part.ICustomDiagramUpdater;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.FinalStateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateChoiceEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateDeepHistoryEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateForkEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateInitialEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJoinEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJunctionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateShallowHistoryEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateTerminateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLNodeDescriptor;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.Region;
-import org.eclipse.uml2.uml.Vertex;
-
-
-public class RegionCompartmentDiagramUpdater implements ICustomDiagramUpdater {
-
- public List<?> getSemanticChildren(View view) {
- if(false == view.eContainer() instanceof View) {
- return Collections.emptyList();
- }
- View containerView = (View)view.eContainer();
- if(!containerView.isSetElement()) {
- return Collections.emptyList();
- }
- Region modelElement = (Region)containerView.getElement();
- LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for(Iterator<?> it = modelElement.getSubvertices().iterator(); it.hasNext();) {
- Vertex childElement = (Vertex)it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if(visualID == PseudostateInitialEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if(visualID == PseudostateJoinEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if(visualID == PseudostateForkEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if(visualID == PseudostateChoiceEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if(visualID == PseudostateJunctionEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if(visualID == PseudostateShallowHistoryEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if(visualID == PseudostateDeepHistoryEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if(visualID == PseudostateTerminateEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if(visualID == PseudostateEntryPointEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if(visualID == PseudostateExitPointEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if(visualID == FinalStateEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if(visualID == StateEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- return result;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomPackageCreationEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomPackageCreationEditPolicy.java
deleted file mode 100644
index 2c9e30f5d7e..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomPackageCreationEditPolicy.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.policies;
-
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand;
-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.CreationEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomStateMachineWithDefaultRegionCreateNodeCommand;
-
-public class CustomPackageCreationEditPolicy extends CreationEditPolicy {
-
- @Override
- protected Command getCreateCommand(CreateViewRequest request) {
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
- CompositeTransactionalCommand cc = new CompositeTransactionalCommand(editingDomain, DiagramUIMessages.AddCommand_Label);
-
- Iterator descriptors = request.getViewDescriptors().iterator();
-
- while(descriptors.hasNext()) {
- CreateViewRequest.ViewDescriptor descriptor = (CreateViewRequest.ViewDescriptor)descriptors.next();
-
- CreateCommand createStateMachine = new CreateCommand(editingDomain, descriptor, (View)(getHost().getModel()));
-
- CustomStateMachineWithDefaultRegionCreateNodeCommand createRegion = new CustomStateMachineWithDefaultRegionCreateNodeCommand((IAdaptable)createStateMachine.getCommandResult().getReturnValue(), ((IGraphicalEditPart)getHost()).getDiagramPreferencesHint(), editingDomain, DiagramUIMessages.CreateCommand_Label, createStateMachine.getAffectedFiles());
-
- cc.compose(createStateMachine);
- cc.compose(createRegion);
-
- }
- return new ICommandProxy(cc.reduce());
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomPackageXYLayoutEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomPackageXYLayoutEditPolicy.java
deleted file mode 100644
index 7760f64f746..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomPackageXYLayoutEditPolicy.java
+++ /dev/null
@@ -1,123 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.policies;
-
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-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.ResizableEditPolicy;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gef.requests.CreateRequest;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.XYLayoutEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.commands.SemanticAdapter;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomStateMachineResizeCommand;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomStateMachineSetBoundsCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineEditPart;
-
-public class CustomPackageXYLayoutEditPolicy extends XYLayoutEditPolicy {
-
- /**
- * This method analyzes a resize and/or move request and routes the call to
- * the appropriate specific ResizeCommand either for a StateMachine
- * in other cases passes on the call to the super class method.
- *
- * @param child
- * the concerned EditPart
- * @param constraint
- * the object embedding the constraint rectangle
- * @param request
- * the ChangeBoundsRequest
- *
- * @return
- */
-
- @Override
- public Command createChangeConstraintCommand(ChangeBoundsRequest request, EditPart child, Object constraint) {
- // precautionary test
- if((request == null) || (child == null) || (constraint == null))
- throw new IllegalArgumentException();
-
- if(child instanceof StateMachineEditPart) {
- View stateMachine = (View)child.getModel();
-
- // retrieve the deltas of the resize request
- int dx = request.getSizeDelta().width;
- int dy = request.getSizeDelta().height;
- if((dx == 0) && (dy == 0)) {
- // nothing to do except move the state machine edit part
- // all locations of embedded figures are relative to it
- // and thus hold when their container is moved around
- return super.createChangeConstraintCommand(request, child, constraint);
- }
-
- // now we face a resize command
-
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
- CompositeTransactionalCommand cc = new CompositeTransactionalCommand(editingDomain, DiagramUIMessages.AddCommand_Label);
- // a resize request, which we route to the specific ResizeCommand
- IAdaptable adaptableForStateMachine = new SemanticAdapter(null, stateMachine);
-
- CustomStateMachineResizeCommand resizeStateMachine = new CustomStateMachineResizeCommand(adaptableForStateMachine, ((IGraphicalEditPart)getHost()).getDiagramPreferencesHint(), editingDomain, DiagramUIMessages.CreateCommand_Label, request, (Rectangle)constraint, false);
-
- cc.add(resizeStateMachine);
-
- return new ICommandProxy(cc.reduce());
- }
- return super.createChangeConstraintCommand(request, child, constraint);
- }
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- // specific resize edit policy which correct ghost figure management by
- // GMF
- if(child instanceof StateMachineEditPart) {
- ResizableEditPolicy policy = new ResizableEditPolicy() {
-
- public void eraseSourceFeedback(Request request) {
- if(RequestConstants.REQ_DROP.equals(request.getType()))
- eraseChangeBoundsFeedback((ChangeBoundsRequest)request);
- else
- super.eraseSourceFeedback(request);
- }
- };
- return policy;
- }
- // all others, namely state machines and states, pseudostates, etc.
- // will have the generic policy which allows resize in all directions
- return super.createChildEditPolicy(child);
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- CreateViewRequest req = (CreateViewRequest)request;
-
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
-
- CompositeTransactionalCommand cc = new CompositeTransactionalCommand(editingDomain, DiagramUIMessages.AddCommand_Label);
- Iterator iter = req.getViewDescriptors().iterator();
-
- final Rectangle BOUNDS = (Rectangle)getConstraintFor(request);
-
- while(iter.hasNext()) {
- CreateViewRequest.ViewDescriptor viewDescriptor = (CreateViewRequest.ViewDescriptor)iter.next();
- Rectangle rect = getBoundsOffest(req, BOUNDS, viewDescriptor);
- cc.compose(new CustomStateMachineSetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, viewDescriptor, rect));
- }
-
- if(cc.reduce() == null)
- return null;
-
- return chainGuideAttachmentCommands(request, new ICommandProxy(cc.reduce()));
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomPseudostateForkJoinResizeEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomPseudostateForkJoinResizeEditPolicy.java
deleted file mode 100644
index b603e337319..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomPseudostateForkJoinResizeEditPolicy.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- */
-
-package org.eclipse.papyrus.diagram.statemachine.custom.policies;
-
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableShapeEditPolicy;
-import org.eclipse.papyrus.diagram.common.editparts.UMLNodeEditPart;
-
-/**
- * A resizable editpolicy for shape editparts. It ensure that the resize keeps the shape as a fork or a join
- *
- * @see ResizableShapeEditPolicy
- */
-public class CustomPseudostateForkJoinResizeEditPolicy extends ResizableShapeEditPolicy {
-
- /**
- * Shows or updates feedback for a change bounds request.
- * The request is updated by the way so that the shape stays a square.
- *
- * @param request
- * the request
- */
- @Override
- protected void showChangeBoundsFeedback(ChangeBoundsRequest request) {
- // adapt the request for a square resize
- if(request.getType().equals(RequestConstants.REQ_RESIZE) && getHost() instanceof UMLNodeEditPart) {
- Dimension dim = getHostFigure().getBounds().getSize();
- Dimension preferedDim = ((UMLNodeEditPart)getHost()).getPrimaryShape().getPreferredSize();
- Dimension delta = request.getSizeDelta();
- int dH = delta.height;
- int dW = delta.width;
- if(dH > dW) {
- dW = preferedDim.width - dim.width;
- } else {
- dH = preferedDim.height - dim.height;
- }
- request.setSizeDelta(new Dimension(dW, dH));
- }
- super.showChangeBoundsFeedback(request);
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomRegionCompartmentCreationEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomRegionCompartmentCreationEditPolicy.java
deleted file mode 100644
index a57add01850..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomRegionCompartmentCreationEditPolicy.java
+++ /dev/null
@@ -1,185 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.policies;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.FigureUtilities;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.Shape;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.PrecisionRectangle;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.LayerConstants;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.editparts.LayerManager;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gef.requests.CreateRequest;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
-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.IHintedType;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.commands.SemanticAdapter;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomRegionCreateElementCommand;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.RegionFigure;
-import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-public class CustomRegionCompartmentCreationEditPolicy extends CreationEditPolicy {
-
- IFigure sizeOnDropFeedback = null;
-
- String dropLocation = Zone.RIGHT;
-
- @Override
- public void eraseTargetFeedback(Request request) {
- if(sizeOnDropFeedback != null) {
- LayerManager.Helper.find(getHost()).getLayer(LayerConstants.FEEDBACK_LAYER).remove(sizeOnDropFeedback);
- sizeOnDropFeedback = null;
- }
- }
-
- @Override
- public Command getCommand(Request request) {
-
- // CHECK THIS
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
- CompositeTransactionalCommand cc = new CompositeTransactionalCommand(editingDomain, DiagramUIMessages.AddCommand_Label);
- if(understandsRequest(request)) {
- if(request instanceof CreateUnspecifiedTypeRequest) {
- CreateUnspecifiedTypeRequest unspecReq = (CreateUnspecifiedTypeRequest)request;
- for(Iterator iter = unspecReq.getElementTypes().iterator(); iter.hasNext();) {
- IElementType elementType = (IElementType)iter.next();
- CreateRequest createRequest = unspecReq.getRequestForType(elementType);
-
- if(((IHintedType)elementType).getSemanticHint().equals(((IHintedType)UMLElementTypes.Region_3000).getSemanticHint())) {
-
- // starting point is the existing region compartment on
- // which mouse was moving
- View existingRegionCompartmentView = (View)getHost().getModel();
- // the existing region view
- View existingRegionView = (View)existingRegionCompartmentView.eContainer();
- // get and adaptable for it, to pass on to commands
- IAdaptable adaptableForExistingRegionView = (IAdaptable)new SemanticAdapter(null, existingRegionView);
-
- // do the whole job
- CustomRegionCreateElementCommand createNewRegion = new CustomRegionCreateElementCommand(adaptableForExistingRegionView, null, ((IGraphicalEditPart)getHost()).getDiagramPreferencesHint(), editingDomain, DiagramUIMessages.CreateCommand_Label, dropLocation);
-
- cc.compose(createNewRegion);
-
- return new ICommandProxy(cc.reduce());
- }
- }
- } else if(request instanceof ChangeBoundsRequest) {
- ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
- Point mouseLocation = changeBoundsRequest.getLocation();
-
- DropObjectsRequest dropRequest = new DropObjectsRequest();
- dropRequest.setLocation(mouseLocation);
-
- List<View> list = new ArrayList<View>();
- Iterator<EditPart> it = changeBoundsRequest.getEditParts().iterator();
- while(it.hasNext()) {
- EditPart ep = it.next();
- if(ep instanceof RegionEditPart) {
- View regionToDrag = (View)ep.getModel();
- list.add(regionToDrag);
- }
- }
- dropRequest.setObjects(list);
- return getHost().getCommand(dropRequest);
- }
-
- return super.getCommand(request);
- }
- return null;
- }
-
- protected IFigure getSizeOnDropFeedback() {
- if(sizeOnDropFeedback == null) {
- sizeOnDropFeedback = new RectangleFigure();
- FigureUtilities.makeGhostShape((Shape)sizeOnDropFeedback);
- ((Shape)sizeOnDropFeedback).setLineStyle(Graphics.LINE_DASHDOT);
- sizeOnDropFeedback.setForegroundColor(ColorConstants.white);
- LayerManager.Helper.find(getHost()).getLayer(LayerConstants.FEEDBACK_LAYER).add(sizeOnDropFeedback);
- }
- return sizeOnDropFeedback;
- }
-
- @Override
- public EditPart getTargetEditPart(Request request) {
-
- if(request instanceof CreateUnspecifiedTypeRequest) {
- CreateUnspecifiedTypeRequest createUnspecifiedTypeRequest = (CreateUnspecifiedTypeRequest)request;
-
- if(understandsRequest(request)) {
- List<?> elementTypes = createUnspecifiedTypeRequest.getElementTypes();
- // Treat the case where only one element type is listed
- // Only take EntryPoint or ExitPoint element type into account
- if((elementTypes.size() == 1) && (((IElementType)(elementTypes.get(0)) == UMLElementTypes.Pseudostate_16000) || ((IElementType)(elementTypes.get(0)) == UMLElementTypes.Pseudostate_17000))) {
- // If the target is a compartment replace by its grand parent edit part
- if((getHost() instanceof ShapeCompartmentEditPart)) {
- return getHost().getParent().getParent().getParent();
- }
- }
- }
- }
-
- return super.getTargetEditPart(request);
- }
-
- @Override
- public void showTargetFeedback(Request request) {
- if(request instanceof CreateUnspecifiedTypeRequest) {
- CreateUnspecifiedTypeRequest unspecReq = (CreateUnspecifiedTypeRequest)request;
- for(Iterator iter = unspecReq.getElementTypes().iterator(); iter.hasNext();) {
- IElementType elementType = (IElementType)iter.next();
- if(elementType.equals(UMLElementTypes.Region_3000)) {
- RegionFigure targetFig = ((RegionEditPart)getHost().getParent()).getPrimaryShape();
-
- // make a local copy
- Rectangle targetFigBounds = targetFig.getBounds().getCopy();
- // transform the coordinates to absolute
- targetFig.translateToAbsolute(targetFigBounds);
- // retrieve mouse location
- Point mouseLocation = unspecReq.getLocation();
-
- // get the drop location, i.e. RIGHT, LEFT, TOP, BOTTOM
- dropLocation = Zone.getZoneFromLocationInRectangleWithAbsoluteCoordinates(mouseLocation, targetFigBounds);
-
- // perform corresponding change (scaling, translation) on
- // targetFigBounds
- // and updates the graph node drop location property
- if(Zone.isTop(dropLocation)) {
- targetFigBounds.setSize(targetFigBounds.getSize().scale(1.0, 0.5));
- } else if(Zone.isLeft(dropLocation)) {
- targetFigBounds.setSize(targetFigBounds.getSize().scale(0.5, 1.0));
- } else if(Zone.isRight(dropLocation)) {
- targetFigBounds.setSize(targetFigBounds.getSize().scale(0.5, 1.0));
- targetFigBounds.translate(targetFigBounds.width, 0);
- } else if(Zone.isBottom(dropLocation)) {
- targetFigBounds.setSize(targetFigBounds.getSize().scale(1.0, 0.5));
- targetFigBounds.translate(0, targetFigBounds.height);
- }
-
- getSizeOnDropFeedback().setBounds(new PrecisionRectangle(targetFigBounds));
- }
- }
- }
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomRegionCompartmentXYLayoutEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomRegionCompartmentXYLayoutEditPolicy.java
deleted file mode 100644
index 6305285a36f..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomRegionCompartmentXYLayoutEditPolicy.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.policies;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-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.ResizableEditPolicy;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-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.XYLayoutEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeConnectionRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.commands.SemanticAdapter;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomStateResizeCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateEditPart;
-
-public class CustomRegionCompartmentXYLayoutEditPolicy extends XYLayoutEditPolicy {
-
- /**
- * This method analyzes a resize and/or move request and routes the call to
- * the appropriate specific ResizeCommand either for a State
- * in other cases passes on the call to the super class method.
- *
- * @param child
- * the concerned EditPart
- * @param constraint
- * the object embedding the constraint rectangle
- * @param request
- * the ChangeBoundsRequest
- *
- * @return
- */
-
- @Override
- public Command createChangeConstraintCommand(ChangeBoundsRequest request, EditPart child, Object constraint) {
- // precautionary test
- if((request == null) || (child == null) || (constraint == null))
- throw new IllegalArgumentException();
-
- if(child instanceof StateEditPart) {
- View state = (View)child.getModel();
-
- // retrieve the deltas of the resize request
- int dx = request.getSizeDelta().width;
- int dy = request.getSizeDelta().height;
- if((dx == 0) && (dy == 0)) {
- // nothing to do except move the state edit part
- // all locations of embedded figures are relative to it
- // and thus hold when their container is moved around
- return super.createChangeConstraintCommand(request, child, constraint);
- }
-
- // now we face a resize command
-
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
- CompositeTransactionalCommand cc = new CompositeTransactionalCommand(editingDomain, DiagramUIMessages.AddCommand_Label);
- // a resize request, which we route to the specific ResizeCommand
- IAdaptable adaptableForState = new SemanticAdapter(null, state);
-
- CustomStateResizeCommand resizeStateMachine = new CustomStateResizeCommand(adaptableForState, ((IGraphicalEditPart)getHost()).getDiagramPreferencesHint(), editingDomain, DiagramUIMessages.CreateCommand_Label, request, (Rectangle)constraint, false);
-
- cc.add(resizeStateMachine);
-
- return new ICommandProxy(cc.reduce());
- }
- return super.createChangeConstraintCommand(request, child, constraint);
- }
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- // specific resize edit policy which correct ghost figure management by
- // GMF
- if(child instanceof StateEditPart) {
- ResizableEditPolicy policy = new ResizableEditPolicy() {
-
- public void eraseSourceFeedback(Request request) {
- if(RequestConstants.REQ_DROP.equals(request.getType()))
- eraseChangeBoundsFeedback((ChangeBoundsRequest)request);
- else
- super.eraseSourceFeedback(request);
- }
- };
- return policy;
- }
- // all others, namely state machines and states, pseudostates, etc.
- // will have the generic policy which allows resize in all directions
- return super.createChildEditPolicy(child);
- }
-
- /**
- *
- * {@inheritedDoc}
- */
- public EditPart getTargetEditPart(Request request) {
- //this enables to make links when pointing inside a region
- if(request instanceof CreateUnspecifiedTypeConnectionRequest)
- return getHost().getParent().getParent().getParent();
- else
- return super.getTargetEditPart(request);
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomRegionComponentEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomRegionComponentEditPolicy.java
deleted file mode 100644
index bc6093ef4ec..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomRegionComponentEditPolicy.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.policies;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.edit.domain.IEditingDomainProvider;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.requests.GroupRequest;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.util.StringStatics;
-import org.eclipse.gmf.runtime.diagram.core.commands.SetPropertyCommand;
-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.ComponentEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.commands.SemanticAdapter;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomRegionDeleteCommand;
-
-public class CustomRegionComponentEditPolicy extends ComponentEditPolicy {
-
- @Override
- protected Command createDeleteViewCommand(GroupRequest deleteRequest) {
- CompositeCommand cc = new CompositeCommand(StringStatics.BLANK);
-
- TransactionalEditingDomain editingDomain = getEditingDomain();
- if(editingDomain == null) {
- return null;
- }
- List toDel = deleteRequest.getEditParts();
- if(toDel == null || toDel.isEmpty()) {
- cc.compose(new CustomRegionDeleteCommand(editingDomain, (View)getHost().getModel()));
-
- View compartmentView = (View)((View)getHost().getModel()).eContainer();
- // get and adaptable for it, to pass on to commands
- IAdaptable adaptableForCompartmentView = (IAdaptable)new SemanticAdapter(null, compartmentView);
- if(compartmentView.getChildren().size() == 1) {
- SetPropertyCommand showCompartment = new SetPropertyCommand(editingDomain, adaptableForCompartmentView, "notation.View.visible", "Visibility", false);
- cc.compose(showCompartment);
- }
- } else {
- for(int i = 0; i < toDel.size(); i++) {
- IGraphicalEditPart gep = (IGraphicalEditPart)toDel.get(i);
- cc.compose(new CustomRegionDeleteCommand(editingDomain, (View)gep.getModel()));
- View compartmentView = (View)((View)getHost().getModel()).eContainer();
- // get and adaptable for it, to pass on to commands
- IAdaptable adaptableForCompartmentView = (IAdaptable)new SemanticAdapter(null, compartmentView);
- if(compartmentView.getChildren().size() == toDel.size()) {
- SetPropertyCommand showCompartment = new SetPropertyCommand(editingDomain, adaptableForCompartmentView, "notation.View.visible", "Visibility", false);
- cc.compose(showCompartment);
- }
- }
- }
- return new ICommandProxy(cc.reduce());
- }
-
- private TransactionalEditingDomain getEditingDomain() {
- if(getHost() instanceof IGraphicalEditPart) {
- return ((IGraphicalEditPart)getHost()).getEditingDomain();
- } else if(getHost() instanceof IEditingDomainProvider) {
- Object domain = ((IEditingDomainProvider)getHost()).getEditingDomain();
- if(domain instanceof TransactionalEditingDomain) {
- return (TransactionalEditingDomain)domain;
- }
- }
- return null;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomRegionDragTracker.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomRegionDragTracker.java
deleted file mode 100644
index 47407ec0b89..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomRegionDragTracker.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.policies;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.commands.SemanticAdapter;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomRegionResizeCommand;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.RegionFigure;
-import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-
-/**
- * A specific drag tracker for regions. It locally stores the potential target
- * edit part during a drag and drop.
- *
- * @author David Servat
- */
-public class CustomRegionDragTracker extends DragEditPartsTrackerEx {
-
- /** The RegionEditPart. */
- protected RegionEditPart regionEP = null;
-
- CustomRegionResizeCommand internalResizeCommand = null;
-
- Rectangle regionFigureBounds;
-
- public CustomRegionDragTracker(RegionEditPart regionEditPart) {
- super(regionEditPart);
- this.regionEP = regionEditPart;
- }
-
- public Rectangle getRegionFigureBounds() {
- return regionFigureBounds.getCopy();
- }
-
- /**
- * This method returns the target RegionEditPart if any, or returns null.
- *
- * @return the target RegionEditPart
- */
- public RegionEditPart getTargetRegionEditPart() {
- EditPart ep = getTargetEditPart();
- if((ep != null) && (ep instanceof RegionCompartmentEditPart) && ep.getParent().getParent().equals(regionEP.getParent())) {
- return (RegionEditPart)ep.getParent();
- }
- return null;
- }
-
- @Override
- protected boolean handleButtonUp(int button) {
- try {
- if(internalResizeCommand != null)
- internalResizeCommand.undo(null, null);
- } catch (ExecutionException e) {
- }
-
- return super.handleButtonUp(button);
- }
-
- @Override
- protected boolean handleDragStarted() {
- // TODO Auto-generated method stub
- boolean b = super.handleDragStarted();
-
- CustomRegionResizableEditPolicy policy = (CustomRegionResizableEditPolicy)regionEP.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
-
- regionEP.setSelected(EditPart.SELECTED_NONE);
-
- View regionView = (View)regionEP.getModel();
- IAdaptable adaptableForRegion = new SemanticAdapter(null, regionView);
-
- ChangeBoundsRequest internalResizeRequest = new ChangeBoundsRequest();
- int regionWidth = Zone.getWidth(regionView);
- int regionHeight = Zone.getHeight(regionView);
-
- RegionFigure regionFigure = regionEP.getPrimaryShape();
- regionFigureBounds = regionFigure.getBounds().getCopy();
- // transform the coordinates to absolute
- regionFigure.translateToAbsolute(regionFigureBounds);
-
- String zone = Zone.getZone(regionView);
- if(Zone.isRight(zone)) {
- internalResizeRequest.setResizeDirection(PositionConstants.WEST);
- internalResizeRequest.setSizeDelta(new Dimension(-regionWidth, 0));
- } else if(Zone.isLeft(zone)) {
- internalResizeRequest.setResizeDirection(PositionConstants.EAST);
- internalResizeRequest.setSizeDelta(new Dimension(-regionWidth, 0));
- } else if(Zone.isTop(zone)) {
- internalResizeRequest.setResizeDirection(PositionConstants.SOUTH);
- internalResizeRequest.setSizeDelta(new Dimension(0, -regionHeight));
- } else if(Zone.isBottom(zone)) {
- internalResizeRequest.setResizeDirection(PositionConstants.NORTH);
- internalResizeRequest.setSizeDelta(new Dimension(0, -regionHeight));
- }
-
- internalResizeCommand = new CustomRegionResizeCommand(adaptableForRegion, null, regionEP.getEditingDomain(), null, internalResizeRequest, null);
-
- try {
- internalResizeCommand.execute(null, null);
- } catch (ExecutionException e) {
- }
-
- return b;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomRegionItemSemanticEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomRegionItemSemanticEditPolicy.java
deleted file mode 100644
index 35a32a89798..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomRegionItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.policies;
-
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
-import org.eclipse.gmf.runtime.diagram.core.commands.SetPropertyCommand;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.commands.SemanticAdapter;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomRegionDeleteCommand;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomRegionDestroyElementCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.RegionItemSemanticEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-
-public class CustomRegionItemSemanticEditPolicy extends RegionItemSemanticEditPolicy {
-
- @Override
- protected Command addDeleteViewCommand(Command mainCommand, DestroyRequest completedRequest) {
- Command deleteViewCommand = getGEFWrapper(new CustomRegionDeleteCommand(getEditingDomain(), (View)getHost().getModel()));
- return mainCommand == null ? deleteViewCommand : mainCommand.chain(deleteViewCommand);
- }
-
- protected void addDestroyChildNodesCommand(ICompositeCommand cmd) {
- View view = (View)getHost().getModel();
- for(Iterator nit = view.getChildren().iterator(); nit.hasNext();) {
- Node node = (Node)nit.next();
- switch(UMLVisualIDRegistry.getVisualID(node)) {
- case RegionCompartmentEditPart.VISUAL_ID:
- for(Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
- Node cnode = (Node)cit.next();
- switch(UMLVisualIDRegistry.getVisualID(cnode)) {
- }
- }
- break;
- }
- }
- }
-
- @Override
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- View view = (View)getHost().getModel();
- CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(false);
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if(annotation == null) {
- // there are indirectly referenced children, need extra commands:
- // false
- addDestroyChildNodesCommand(cmd);
- addDestroyShortcutsCommand(cmd, view);
- // delete host element
- cmd.add(new CustomRegionDestroyElementCommand(req));
- } else {
- cmd.add(new CustomRegionDeleteCommand(getEditingDomain(), view));
- }
- View compartmentView = (View)view.eContainer();
- // get and adaptable for it, to pass on to commands
- IAdaptable adaptableForCompartmentView = (IAdaptable)new SemanticAdapter(null, compartmentView);
- if(compartmentView.getChildren().size() == 1) {
- SetPropertyCommand showCompartment = new SetPropertyCommand(getEditingDomain(), adaptableForCompartmentView, "notation.View.visible", "Visibility", false);
- cmd.compose(showCompartment);
- }
-
- return getGEFWrapper(cmd.reduce());
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomRegionResizableEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomRegionResizableEditPolicy.java
deleted file mode 100644
index e8a0ea97864..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomRegionResizableEditPolicy.java
+++ /dev/null
@@ -1,167 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.policies;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.PrecisionRectangle;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.editpolicies.ResizableEditPolicy;
-import org.eclipse.gef.handles.ResizableHandleKit;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.RegionFigure;
-import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-
-public class CustomRegionResizableEditPolicy extends ResizableEditPolicy {
-
- /** The associated request. */
- private ChangeBoundsRequest request;
-
- /**
- * The target figure, i.e. the figure associated to the targetNode region .
- * Used to change of coordinates.
- */
- private RegionFigure targetFig;
-
- /** Flag to indicate a change in the referent figure is needed. */
- private boolean changeReferentFigure = false;
-
- /**
- * Provides a specific list of SelectionHandles.
- *
- * @return a list of the Handles
- */
- @Override
- protected List createSelectionHandles() {
- List list = new ArrayList();
- int dirs = getResizeDirections();
- // by default (case when dirs == -1 or 0)
- // no move nor resize handles are provided
- // this is to cope with the default region included in the statemachine
- // for which it would not make any sense
- if(dirs > 0) {
- // resize handles are added depending on a bit-wise test of dirs
- // in any case we do not provide oblique resize handles
- if((dirs & PositionConstants.EAST) != 0)
- ResizableHandleKit.addHandle((GraphicalEditPart)getHost(), list, PositionConstants.EAST);
- if((dirs & PositionConstants.SOUTH) != 0)
- ResizableHandleKit.addHandle((GraphicalEditPart)getHost(), list, PositionConstants.SOUTH);
- if((dirs & PositionConstants.WEST) != 0)
- ResizableHandleKit.addHandle((GraphicalEditPart)getHost(), list, PositionConstants.WEST);
- if((dirs & PositionConstants.NORTH) != 0) {
- ResizableHandleKit.addHandle((GraphicalEditPart)getHost(), list, PositionConstants.NORTH);
- }
- }
- return list;
- }
-
- /**
- * This method is overridden to change the ghost figure shown when either
- * resizing a region or moving it around. In the case of a resize we need to
- * update the bounds of the ghost figure as the union of bounds of resized
- * regions. This is done by a check of the neighboring regions which share
- * the same border to be moved by the resize request. In the case of a move
- * we need to show what will happen to the region when dropped on a given
- * one: thus show a half-sized region located on one of the side of its
- * parent region depending on the position of the mouse. In the course of
- * this process we assign a corresponding drop location to the region.
- *
- * @param a
- * rectangle which is the bounds of the ghost figure to be shown
- */
- @Override
- protected Rectangle getInitialFeedbackBounds() {
- Dimension sizeDelta = request.getSizeDelta();
-
- // restore default flag value
- changeReferentFigure = false;
-
- // we test whether this is a move request or a resize request
- if((sizeDelta.width == 0) && (sizeDelta.height == 0)) {
- return super.getInitialFeedbackBounds();
- }
- // this is a resize request
- else {
- // retrieve the direction of resize
- int direction = request.getResizeDirection();
- // retrieve the edit part associated to the policy
- RegionEditPart regionEP = (RegionEditPart)getHost();
- // the associated region view
- View region = (View)regionEP.getModel();
- // a list to get all the nodes impacted by the resize
- List<View> nodes = new ArrayList<View>();
- // test the direction and call the appropriate method
- if(direction == PositionConstants.NORTH)
- // retrieve the list of nodes that are at the BOTTOM of NORTH
- // border
- nodes = Zone.getRegionTopBorderInsideNeighbours(region);
- else if(direction == PositionConstants.SOUTH)
- // retrieve the list of nodes that are at the TOP of SOUTH
- // border
- nodes = Zone.getRegionBottomBorderInsideNeighbours(region);
- else if(direction == PositionConstants.EAST)
- // retrieve the list of nodes that are at the LEFT of EAST
- // border
- nodes = Zone.getRegionRightBorderInsideNeighbours(region);
- else if(direction == PositionConstants.WEST)
- // retrieve the list of nodes that are at the RIGHT of WEST
- // border
- nodes = Zone.getRegionLeftBorderInsideNeighbours(region);
- // now compute the bounds of the node union
- Rectangle rect = null;
- Iterator<View> it = nodes.iterator();
- while(it.hasNext()) {
- View view = it.next();
- Rectangle currentBounds = Zone.getBounds(view);
- if(rect == null)
- rect = currentBounds;
- else
- rect = rect.union(currentBounds);
- }
- return rect;
- }
- }
-
- /**
- * This method is overridden here to save the request and change the figure
- * used to perform coordinate change.
- *
- * @param request
- * the Request
- */
- @Override
- protected void showChangeBoundsFeedback(ChangeBoundsRequest request) {
- this.request = (ChangeBoundsRequest)request;
- IFigure feedback = getDragSourceFeedbackFigure();
-
- PrecisionRectangle rect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy());
-
- // if regions are part of different state machines or state
- if(changeReferentFigure)
- // use the target figure as referent for coordinate change
- targetFig.translateToAbsolute(rect);
- // both regions are part of the same state machine or state
- else
- // use default host figure
- getHostFigure().translateToAbsolute(rect);
- rect.translate(request.getMoveDelta());
- rect.resize(request.getSizeDelta());
-
- feedback.translateToRelative(rect);
- feedback.setBounds(rect);
- }
-
- @Override
- public void showSourceFeedback(Request request) {
- if(REQ_RESIZE.equals(request.getType()))
- showChangeBoundsFeedback((ChangeBoundsRequest)request);
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateCompartmentCreationEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateCompartmentCreationEditPolicy.java
deleted file mode 100644
index 5d8b4e9d726..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateCompartmentCreationEditPolicy.java
+++ /dev/null
@@ -1,193 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.policies;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gef.requests.CreateRequest;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
-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.IHintedType;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.commands.SemanticAdapter;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomFirstRegionInCompositeStateCreateElementCommand;
-import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-public class CustomStateCompartmentCreationEditPolicy extends CreationEditPolicy {
-
- IFigure sizeOnDropFeedback = null;
-
- String dropLocation = Zone.NONE;
-
- @Override
- public Command getCommand(Request request) {
-
- // CHECK THIS
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
- CompositeTransactionalCommand cc = new CompositeTransactionalCommand(editingDomain, DiagramUIMessages.AddCommand_Label);
- if(understandsRequest(request)) {
- if(request instanceof CreateUnspecifiedTypeRequest) {
- CreateUnspecifiedTypeRequest unspecReq = (CreateUnspecifiedTypeRequest)request;
- for(Iterator iter = unspecReq.getElementTypes().iterator(); iter.hasNext();) {
- IElementType elementType = (IElementType)iter.next();
- CreateRequest createRequest = unspecReq.getRequestForType(elementType);
-
- if(((IHintedType)elementType).getSemanticHint().equals(((IHintedType)UMLElementTypes.Region_3000).getSemanticHint())) {
-
- // starting point is the state compartment on
- // which mouse was moving
- View stateCompartmentView = (View)getHost().getModel();
- // get and adaptable for it, to pass on to commands
- IAdaptable adaptableForStateCompartmentView = (IAdaptable)new SemanticAdapter(null, stateCompartmentView);
-
- // do the whole job
- CustomFirstRegionInCompositeStateCreateElementCommand createNewRegion = new CustomFirstRegionInCompositeStateCreateElementCommand(adaptableForStateCompartmentView, null, ((IGraphicalEditPart)getHost()).getDiagramPreferencesHint(), editingDomain, DiagramUIMessages.CreateCommand_Label, dropLocation);
-
- cc.compose(createNewRegion);
-
- return new ICommandProxy(cc.reduce());
- }
- }
- } else if(request instanceof ChangeBoundsRequest) {
- ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
- Point mouseLocation = changeBoundsRequest.getLocation();
-
- DropObjectsRequest dropRequest = new DropObjectsRequest();
- dropRequest.setLocation(mouseLocation);
-
- List<View> list = new ArrayList<View>();
- Iterator<EditPart> it = changeBoundsRequest.getEditParts().iterator();
- while(it.hasNext()) {
- EditPart ep = it.next();
- if(ep instanceof RegionEditPart) {
- View regionToDrag = (View)ep.getModel();
- list.add(regionToDrag);
- }
- }
- dropRequest.setObjects(list);
- return getHost().getCommand(dropRequest);
- }
-
- return super.getCommand(request);
- }
- return null;
- }
-
- @Override
- public EditPart getTargetEditPart(Request request) {
- if(request instanceof CreateUnspecifiedTypeRequest) {
- CreateUnspecifiedTypeRequest createUnspecifiedTypeRequest = (CreateUnspecifiedTypeRequest)request;
-
- if(understandsRequest(request)) {
- List<?> elementTypes = createUnspecifiedTypeRequest.getElementTypes();
- // Treat the case where only one element type is listed
- // Only take EntryPoint or ExitPoint element type into account
- if((elementTypes.size() == 1) && (((IElementType)(elementTypes.get(0)) == UMLElementTypes.ConnectionPointReference_18000))) {
- // If the target is a compartment replace by its parent edit part
- if((getHost() instanceof ShapeCompartmentEditPart)) {
- return getHost().getParent();
- }
- }
- }
- }
-
- return super.getTargetEditPart(request);
- }
- // @Override
- // public void eraseTargetFeedback(Request request) {
- // if(sizeOnDropFeedback != null) {
- // LayerManager.Helper.find(getHost()).getLayer(LayerConstants.FEEDBACK_LAYER).remove(sizeOnDropFeedback);
- // sizeOnDropFeedback = null;
- // }
- // }
-
- // protected IFigure getSizeOnDropFeedback() {
- // if(sizeOnDropFeedback == null) {
- // sizeOnDropFeedback = new RectangleFigure();
- // FigureUtilities.makeGhostShape((Shape)sizeOnDropFeedback);
- // ((Shape)sizeOnDropFeedback).setLineStyle(Graphics.LINE_DASHDOT);
- // sizeOnDropFeedback.setForegroundColor(ColorConstants.white);
- // LayerManager.Helper.find(getHost()).getLayer(LayerConstants.FEEDBACK_LAYER).add(sizeOnDropFeedback);
- // }
- // return sizeOnDropFeedback;
- // }
-
- // @Override
- // public EditPart getTargetEditPart(Request request) {
- //
- // if(request instanceof CreateUnspecifiedTypeRequest) {
- // CreateUnspecifiedTypeRequest createUnspecifiedTypeRequest = (CreateUnspecifiedTypeRequest)request;
- //
- // if(understandsRequest(request)) {
- // List<?> elementTypes = createUnspecifiedTypeRequest.getElementTypes();
- // // Treat the case where only one element type is listed
- // // Only take EntryPoint or ExitPoint element type into account
- // if((elementTypes.size() == 1) && (((IElementType)(elementTypes.get(0)) == UMLElementTypes.Pseudostate_16000) || ((IElementType)(elementTypes.get(0)) == UMLElementTypes.Pseudostate_17000))) {
- // // If the target is a compartment replace by its grand parent edit part
- // if((getHost() instanceof ShapeCompartmentEditPart)) {
- // return getHost().getParent().getParent().getParent();
- // }
- // }
- // }
- // }
- //
- // return super.getTargetEditPart(request);
- // }
- //
- // @Override
- // public void showTargetFeedback(Request request) {
- // if(request instanceof CreateUnspecifiedTypeRequest) {
- // CreateUnspecifiedTypeRequest unspecReq = (CreateUnspecifiedTypeRequest)request;
- // for(Iterator iter = unspecReq.getElementTypes().iterator(); iter.hasNext();) {
- // IElementType elementType = (IElementType)iter.next();
- // if(elementType.equals(UMLElementTypes.Region_3000)) {
- // RegionFigure targetFig = ((RegionEditPart)getHost().getParent()).getPrimaryShape();
- //
- // // make a local copy
- // Rectangle targetFigBounds = targetFig.getBounds().getCopy();
- // // transform the coordinates to absolute
- // targetFig.translateToAbsolute(targetFigBounds);
- // // retrieve mouse location
- // Point mouseLocation = unspecReq.getLocation();
- //
- // // get the drop location, i.e. RIGHT, LEFT, TOP, BOTTOM
- // dropLocation = Zone.getZoneFromLocationInRectangleWithAbsoluteCoordinates(mouseLocation, targetFigBounds);
- //
- // // perform corresponding change (scaling, translation) on
- // // targetFigBounds
- // // and updates the graph node drop location property
- // if(Zone.isTop(dropLocation)) {
- // targetFigBounds.setSize(targetFigBounds.getSize().scale(1.0, 0.5));
- // } else if(Zone.isLeft(dropLocation)) {
- // targetFigBounds.setSize(targetFigBounds.getSize().scale(0.5, 1.0));
- // } else if(Zone.isRight(dropLocation)) {
- // targetFigBounds.setSize(targetFigBounds.getSize().scale(0.5, 1.0));
- // targetFigBounds.translate(targetFigBounds.width, 0);
- // } else if(Zone.isBottom(dropLocation)) {
- // targetFigBounds.setSize(targetFigBounds.getSize().scale(1.0, 0.5));
- // targetFigBounds.translate(0, targetFigBounds.height);
- // }
- //
- // getSizeOnDropFeedback().setBounds(new PrecisionRectangle(targetFigBounds));
- // }
- // }
- // }
- // }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateCompartmentXYLayoutEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateCompartmentXYLayoutEditPolicy.java
deleted file mode 100644
index bd3dafa5136..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateCompartmentXYLayoutEditPolicy.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.policies;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-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.XYLayoutEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.commands.SemanticAdapter;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomRegionResizeCommand;
-import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-
-public class CustomStateCompartmentXYLayoutEditPolicy extends XYLayoutEditPolicy {
-
- /**
- * This method analyzes a resize and/or move request and routes the call to
- * the appropriate specific ResizeCommand either for a Region, in other
- * cases passes on the call to the super class method.
- *
- * @param child
- * the concerned EditPart
- * @param constraint
- * the object embedding the constraint rectangle
- * @param request
- * the ChangeBoundsRequest
- *
- * @return
- */
-
- @Override
- protected Command createChangeConstraintCommand(ChangeBoundsRequest request, EditPart child, Object constraint) {
- // precautionary test
- if((request == null) || (child == null) || (constraint == null))
- throw new IllegalArgumentException();
-
- if(child instanceof RegionEditPart) {
- View region = (View)child.getModel();
-
- // retrieve the deltas of the resize request
- int dx = request.getSizeDelta().width;
- int dy = request.getSizeDelta().height;
- if((dx == 0) && (dy == 0)) {
- return UnexecutableCommand.INSTANCE;
- }
-
- // now we face a resize command involving potentially multiple
- // regions
-
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
- CompositeTransactionalCommand cc = new CompositeTransactionalCommand(editingDomain, DiagramUIMessages.AddCommand_Label);
- // a resize request, which we route to the specific ResizeCommand
- IAdaptable adaptableForRegion = new SemanticAdapter(null, region);
-
- CustomRegionResizeCommand resizeRegion = new CustomRegionResizeCommand(adaptableForRegion, ((IGraphicalEditPart)getHost()).getDiagramPreferencesHint(), editingDomain, DiagramUIMessages.CreateCommand_Label, request, (Rectangle)constraint);
-
- cc.add(resizeRegion);
-
- return new ICommandProxy(cc.reduce());
- }
- return super.createChangeConstraintCommand(request, child, constraint);
- }
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- // specific resize edit policy for regions
- // we want to avoid resize in oblique directions such as NORTH_EAST
- // and restrict resize to inner expansion
- // which do not cause a resize of the embedding statemachine
- if(child instanceof RegionEditPart) {
- CustomRegionResizableEditPolicy policy = new CustomRegionResizableEditPolicy();
- // retrieve the region view
- View region = (View)child.getModel();
- // its zone property
- String zone = Zone.getZone(region);
- // test for allowed directions
- int dirs = Zone.getAllowedResizeDirections(zone);
- // constrain the edit policy with these directions
- policy.setResizeDirections(dirs);
- return policy;
- }
- // all others, namely state machines and states, pseudostates, etc.
- // will have the generic policy which allows resize in all directions
- return super.createChildEditPolicy(child);
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateCreationEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateCreationEditPolicy.java
deleted file mode 100644
index c3beef69772..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateCreationEditPolicy.java
+++ /dev/null
@@ -1,217 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.policies;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gef.requests.CreateRequest;
-import org.eclipse.gmf.runtime.diagram.core.commands.SetPropertyCommand;
-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.CreationEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
-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.IHintedType;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.commands.SemanticAdapter;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomFirstRegionInCompositeStateCreateElementCommand;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomVertexCreateElementCommand;
-import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.uml2.uml.State;
-
-public class CustomStateCreationEditPolicy extends CreationEditPolicy {
-
- IFigure sizeOnDropFeedback = null;
-
- String dropLocation = Zone.NONE;
-
- // @Override
- // public void eraseTargetFeedback(Request request) {
- // if(sizeOnDropFeedback != null) {
- // LayerManager.Helper.find(getHost()).getLayer(LayerConstants.FEEDBACK_LAYER).remove(sizeOnDropFeedback);
- // sizeOnDropFeedback = null;
- // }
- // }
-
- @Override
- public Command getCommand(Request request) {
-
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
- CompositeTransactionalCommand cc = new CompositeTransactionalCommand(editingDomain, DiagramUIMessages.AddCommand_Label);
- if(understandsRequest(request)) {
- if(request instanceof CreateUnspecifiedTypeRequest) {
- CreateUnspecifiedTypeRequest unspecReq = (CreateUnspecifiedTypeRequest)request;
- for(Iterator iter = unspecReq.getElementTypes().iterator(); iter.hasNext();) {
- IElementType elementType = (IElementType)iter.next();
- CreateRequest createRequest = unspecReq.getRequestForType(elementType);
-
- if(((IHintedType)elementType).getSemanticHint().equals(((IHintedType)UMLElementTypes.Region_3000).getSemanticHint())) {
-
- // starting point is the state node on
- // which mouse was moving
- View stateView = (View)getHost().getModel();
- View stateCompartmentView = (View)stateView.getChildren().get(1);
-
- // get and adaptable for it, to pass on to commands
- IAdaptable adaptableForStateCompartmentView = (IAdaptable)new SemanticAdapter(null, stateCompartmentView);
-
- if(!stateCompartmentView.getChildren().isEmpty()) {
- // CHECK THIS
- // ENamedElement namedElement = PackageUtil.getElement("notation.View.visible");
- // if(ViewUtil.getStructuralFeatureValue(stateCompartmentView, (EStructuralFeature)namedElement).equals(new Boolean(false))){
- // SetPropertyCommand showCompartment = new SetPropertyCommand(editingDomain, adaptableForStateCompartmentView, "notation.View.visible", "Visibility", true);
- // showCompartment.setOptions(Collections.singletonMap(Transaction.OPTION_UNPROTECTED, Boolean.TRUE));
- //
- // try {
- // showCompartment.execute(null, null);
- // } catch (ExecutionException e) {
- // }
- // }
- return null;
- }
-
-
- // do the whole job
- CustomFirstRegionInCompositeStateCreateElementCommand createNewRegion = new CustomFirstRegionInCompositeStateCreateElementCommand(adaptableForStateCompartmentView, null, ((IGraphicalEditPart)getHost()).getDiagramPreferencesHint(), editingDomain, DiagramUIMessages.CreateCommand_Label, dropLocation);
- SetPropertyCommand showCompartment = new SetPropertyCommand(editingDomain, adaptableForStateCompartmentView, "notation.View.visible", "Visibility", true);
- cc.compose(showCompartment);
- cc.compose(createNewRegion);
-
-
- return new ICommandProxy(cc.reduce());
- } else if(((IHintedType)elementType).getSemanticHint().equals(((IHintedType)UMLElementTypes.Pseudostate_8000).getSemanticHint()) || ((IHintedType)elementType).getSemanticHint().equals(((IHintedType)UMLElementTypes.Pseudostate_9000).getSemanticHint()) || ((IHintedType)elementType).getSemanticHint().equals(((IHintedType)UMLElementTypes.Pseudostate_10000).getSemanticHint()) || ((IHintedType)elementType).getSemanticHint().equals(((IHintedType)UMLElementTypes.Pseudostate_11000).getSemanticHint()) || ((IHintedType)elementType).getSemanticHint().equals(((IHintedType)UMLElementTypes.Pseudostate_12000).getSemanticHint()) || ((IHintedType)elementType).getSemanticHint().equals(((IHintedType)UMLElementTypes.Pseudostate_13000).getSemanticHint()) || ((IHintedType)elementType).getSemanticHint().equals(((IHintedType)UMLElementTypes.Pseudostate_14000).getSemanticHint()) || ((IHintedType)elementType).getSemanticHint().equals(((IHintedType)UMLElementTypes.Pseudostate_15000).getSemanticHint()) || ((IHintedType)elementType).getSemanticHint().equals(((IHintedType)UMLElementTypes.Pseudostate_16000).getSemanticHint()) || ((IHintedType)elementType).getSemanticHint().equals(((IHintedType)UMLElementTypes.Pseudostate_17000).getSemanticHint()) || ((IHintedType)elementType).getSemanticHint().equals(((IHintedType)UMLElementTypes.State_6000).getSemanticHint()) || ((IHintedType)elementType).getSemanticHint().equals(((IHintedType)UMLElementTypes.FinalState_5000).getSemanticHint())) {
-
- // starting point is the state node on
- // which mouse was moving
- View stateView = (View)getHost().getModel();
- View stateCompartmentView = (View)stateView.getChildren().get(1);
-
- // transfer the request to the super method to deal with regular Entry/ExitPoint creation
- if(!stateCompartmentView.getChildren().isEmpty() || !((State)stateView.getElement()).getRegions().isEmpty())
- return super.getCommand(request);
-
- // get and adaptable for it, to pass on to commands
- IAdaptable adaptableForStateCompartmentView = (IAdaptable)new SemanticAdapter(null, stateCompartmentView);
-
- // do the whole job
- CustomFirstRegionInCompositeStateCreateElementCommand createNewRegion = new CustomFirstRegionInCompositeStateCreateElementCommand(adaptableForStateCompartmentView, null, ((IGraphicalEditPart)getHost()).getDiagramPreferencesHint(), editingDomain, DiagramUIMessages.CreateCommand_Label, dropLocation);
- SetPropertyCommand showCompartment = new SetPropertyCommand(editingDomain, adaptableForStateCompartmentView, "notation.View.visible", "Visibility", true);
- CustomVertexCreateElementCommand createVertex = new CustomVertexCreateElementCommand((IAdaptable)createNewRegion.getCommandResult().getReturnValue(), (IHintedType)elementType, ((IGraphicalEditPart)getHost()).getDiagramPreferencesHint(), editingDomain, DiagramUIMessages.CreateCommand_Label);
- cc.compose(showCompartment);
- cc.compose(createNewRegion);
- cc.compose(createVertex);
-
- return new ICommandProxy(cc.reduce());
- }
- }
- } else if(request instanceof ChangeBoundsRequest) {
- ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
- Point mouseLocation = changeBoundsRequest.getLocation();
-
- DropObjectsRequest dropRequest = new DropObjectsRequest();
- dropRequest.setLocation(mouseLocation);
-
- List<View> list = new ArrayList<View>();
- Iterator<EditPart> it = changeBoundsRequest.getEditParts().iterator();
- while(it.hasNext()) {
- EditPart ep = it.next();
- if(ep instanceof RegionEditPart) {
- View regionToDrag = (View)ep.getModel();
- list.add(regionToDrag);
- }
- }
- dropRequest.setObjects(list);
- return getHost().getCommand(dropRequest);
- }
-
- return super.getCommand(request);
- }
- return null;
- }
-
- // protected IFigure getSizeOnDropFeedback() {
- // if(sizeOnDropFeedback == null) {
- // sizeOnDropFeedback = new RectangleFigure();
- // FigureUtilities.makeGhostShape((Shape)sizeOnDropFeedback);
- // ((Shape)sizeOnDropFeedback).setLineStyle(Graphics.LINE_DASHDOT);
- // sizeOnDropFeedback.setForegroundColor(ColorConstants.white);
- // LayerManager.Helper.find(getHost()).getLayer(LayerConstants.FEEDBACK_LAYER).add(sizeOnDropFeedback);
- // }
- // return sizeOnDropFeedback;
- // }
-
- // @Override
- // public EditPart getTargetEditPart(Request request) {
- //
- // if(request instanceof CreateUnspecifiedTypeRequest) {
- // CreateUnspecifiedTypeRequest createUnspecifiedTypeRequest = (CreateUnspecifiedTypeRequest)request;
- //
- // if(understandsRequest(request)) {
- // List<?> elementTypes = createUnspecifiedTypeRequest.getElementTypes();
- // // Treat the case where only one element type is listed
- // // Only take EntryPoint or ExitPoint element type into account
- // if((elementTypes.size() == 1) && (((IElementType)(elementTypes.get(0)) == UMLElementTypes.Pseudostate_16000) || ((IElementType)(elementTypes.get(0)) == UMLElementTypes.Pseudostate_17000))) {
- // // If the target is a compartment replace by its grand parent edit part
- // if((getHost() instanceof ShapeCompartmentEditPart)) {
- // return getHost().getParent().getParent().getParent();
- // }
- // }
- // }
- // }
- //
- // return super.getTargetEditPart(request);
- // }
- //
- // @Override
- // public void showTargetFeedback(Request request) {
- // if(request instanceof CreateUnspecifiedTypeRequest) {
- // CreateUnspecifiedTypeRequest unspecReq = (CreateUnspecifiedTypeRequest)request;
- // for(Iterator iter = unspecReq.getElementTypes().iterator(); iter.hasNext();) {
- // IElementType elementType = (IElementType)iter.next();
- // if(elementType.equals(UMLElementTypes.Region_3000)) {
- // RegionFigure targetFig = ((RegionEditPart)getHost().getParent()).getPrimaryShape();
- //
- // // make a local copy
- // Rectangle targetFigBounds = targetFig.getBounds().getCopy();
- // // transform the coordinates to absolute
- // targetFig.translateToAbsolute(targetFigBounds);
- // // retrieve mouse location
- // Point mouseLocation = unspecReq.getLocation();
- //
- // // get the drop location, i.e. RIGHT, LEFT, TOP, BOTTOM
- // dropLocation = Zone.getZoneFromLocationInRectangleWithAbsoluteCoordinates(mouseLocation, targetFigBounds);
- //
- // // perform corresponding change (scaling, translation) on
- // // targetFigBounds
- // // and updates the graph node drop location property
- // if(Zone.isTop(dropLocation)) {
- // targetFigBounds.setSize(targetFigBounds.getSize().scale(1.0, 0.5));
- // } else if(Zone.isLeft(dropLocation)) {
- // targetFigBounds.setSize(targetFigBounds.getSize().scale(0.5, 1.0));
- // } else if(Zone.isRight(dropLocation)) {
- // targetFigBounds.setSize(targetFigBounds.getSize().scale(0.5, 1.0));
- // targetFigBounds.translate(targetFigBounds.width, 0);
- // } else if(Zone.isBottom(dropLocation)) {
- // targetFigBounds.setSize(targetFigBounds.getSize().scale(1.0, 0.5));
- // targetFigBounds.translate(0, targetFigBounds.height);
- // }
- //
- // getSizeOnDropFeedback().setBounds(new PrecisionRectangle(targetFigBounds));
- // }
- // }
- // }
- // }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateItemSemanticEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateItemSemanticEditPolicy.java
deleted file mode 100644
index f58c5e67c5d..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomConnectionPointReferenceCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomPseudostateEntryPointCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomPseudostateExitPointCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.StateItemSemanticEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-
-public class CustomStateItemSemanticEditPolicy extends StateItemSemanticEditPolicy {
-
- @Override
- protected Command getCreateCommand(CreateElementRequest req) {
- if(UMLElementTypes.Pseudostate_16000 == req.getElementType()) {
- return getGEFWrapper(new CustomPseudostateEntryPointCreateCommand(req));
- }
- if(UMLElementTypes.Pseudostate_17000 == req.getElementType()) {
- return getGEFWrapper(new CustomPseudostateExitPointCreateCommand(req));
- }
- if(UMLElementTypes.ConnectionPointReference_18000 == req.getElementType()) {
- return getGEFWrapper(new CustomConnectionPointReferenceCreateCommand(req));
- }
- return super.getCreateCommand(req);
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateLayoutEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateLayoutEditPolicy.java
deleted file mode 100644
index dc2d2bab014..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateLayoutEditPolicy.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.policies;
-
-import java.util.Iterator;
-
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-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.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.editpolicies.BorderItemResizableEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.custom.locators.CustomEntryExitPointPositionLocator;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.ConnectionPointReferenceEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-/**
- * This edit policy replaces the GMF generated edit policy for StateMachine(s).
- * In particular it provides a getCreateCommands that add a ChangeBoundRequest on a created Entry/ExitPoint
- * in order to locate it at the cursor position.
- */
-public class CustomStateLayoutEditPolicy extends LayoutEditPolicy {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View)child.getModel();
- switch(UMLVisualIDRegistry.getVisualID(childView)) {
- case PseudostateEntryPointEditPart.VISUAL_ID:
- case PseudostateExitPointEditPart.VISUAL_ID:
- case ConnectionPointReferenceEditPart.VISUAL_ID:
-
- return new BorderItemResizableEditPolicy();
-
- }
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- public Command getCommand(Request request) {
- // TODO Auto-generated method stub
- return super.getCommand(request);
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- if(request instanceof CreateViewAndElementRequest) {
-
- CreateViewAndElementRequest req = (CreateViewAndElementRequest)request;
-
- if(req.getViewAndElementDescriptor().getSemanticHint().equals(((IHintedType)UMLElementTypes.Pseudostate_16000).getSemanticHint()) || req.getViewAndElementDescriptor().getSemanticHint().equals(((IHintedType)UMLElementTypes.Pseudostate_17000).getSemanticHint()) || req.getViewAndElementDescriptor().getSemanticHint().equals(((IHintedType)UMLElementTypes.ConnectionPointReference_18000).getSemanticHint())) {
-
-
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
-
- CompositeTransactionalCommand cc = new CompositeTransactionalCommand(editingDomain, DiagramUIMessages.AddCommand_Label);
- Iterator<?> iter = req.getViewDescriptors().iterator();
-
- // Retrieve parent location
- Point parentLoc = getHostFigure().getBounds().getLocation().getCopy();
-
- // Compute relative creation location
- Point requestedLocation = request.getLocation().getCopy();
- getHostFigure().translateToRelative(requestedLocation);
-
- // Create proposed creation bounds and use the locator to find the expected position
- CustomEntryExitPointPositionLocator locator = new CustomEntryExitPointPositionLocator(getHostFigure(), PositionConstants.NONE);
- Rectangle proposedBounds = new Rectangle(requestedLocation, new Dimension(20, 20));
- Rectangle preferredBounds = locator.getPreferredLocation(proposedBounds);
-
- // Convert the calculated preferred bounds as relative to parent location
- Rectangle creationBounds = preferredBounds.getTranslated(parentLoc.getNegated());
-
- while(iter.hasNext()) {
-
- CreateViewRequest.ViewDescriptor viewDescriptor = (CreateViewRequest.ViewDescriptor)iter.next();
- cc.compose(new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, viewDescriptor, creationBounds));
- }
-
- if(cc.reduce() == null)
- return null;
-
- return new ICommandProxy(cc.reduce());
- }
- }
- return null;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateMachineCompartmentXYLayoutEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateMachineCompartmentXYLayoutEditPolicy.java
deleted file mode 100644
index 5e9b79a6f6f..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateMachineCompartmentXYLayoutEditPolicy.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.policies;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-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.XYLayoutEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.commands.SemanticAdapter;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomRegionResizeCommand;
-import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-
-public class CustomStateMachineCompartmentXYLayoutEditPolicy extends XYLayoutEditPolicy {
-
- /**
- * This method analyzes a resize and/or move request and routes the call to
- * the appropriate specific ResizeCommand either for a Region, in other
- * cases passes on the call to the super class method.
- *
- * @param child
- * the concerned EditPart
- * @param constraint
- * the object embedding the constraint rectangle
- * @param request
- * the ChangeBoundsRequest
- *
- * @return
- */
-
- @Override
- protected Command createChangeConstraintCommand(ChangeBoundsRequest request, EditPart child, Object constraint) {
- // precautionary test
- if((request == null) || (child == null) || (constraint == null))
- throw new IllegalArgumentException();
-
- if(child instanceof RegionEditPart) {
- View region = (View)child.getModel();
-
- // retrieve the deltas of the resize request
- int dx = request.getSizeDelta().width;
- int dy = request.getSizeDelta().height;
- if((dx == 0) && (dy == 0)) {
- return UnexecutableCommand.INSTANCE;
- }
-
- // now we face a resize command involving potentially multiple
- // regions
-
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
- CompositeTransactionalCommand cc = new CompositeTransactionalCommand(editingDomain, DiagramUIMessages.AddCommand_Label);
- // a resize request, which we route to the specific ResizeCommand
- IAdaptable adaptableForRegion = new SemanticAdapter(null, region);
-
- CustomRegionResizeCommand resizeRegion = new CustomRegionResizeCommand(adaptableForRegion, ((IGraphicalEditPart)getHost()).getDiagramPreferencesHint(), editingDomain, DiagramUIMessages.CreateCommand_Label, request, (Rectangle)constraint);
-
- cc.add(resizeRegion);
-
- return new ICommandProxy(cc.reduce());
- }
- return super.createChangeConstraintCommand(request, child, constraint);
- }
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- // specific resize edit policy for regions
- // we want to avoid resize in oblique directions such as NORTH_EAST
- // and restrict resize to inner expansion
- // which do not cause a resize of the embedding statemachine
- if(child instanceof RegionEditPart) {
- CustomRegionResizableEditPolicy policy = new CustomRegionResizableEditPolicy();
- // retrieve the region view
- View region = (View)child.getModel();
- // its zone property
- String zone = Zone.getZone(region);
- // test for allowed directions
- int dirs = Zone.getAllowedResizeDirections(zone);
- // constrain the edit policy with these directions
- policy.setResizeDirections(dirs);
- return policy;
- }
- // all others, namely state machines and states, pseudostates, etc.
- // will have the generic policy which allows resize in all directions
- return super.createChildEditPolicy(child);
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateMachineDiagramDragDropEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateMachineDiagramDragDropEditPolicy.java
deleted file mode 100644
index 80add3a5f41..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateMachineDiagramDragDropEditPolicy.java
+++ /dev/null
@@ -1,791 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.policies;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.FigureUtilities;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.Shape;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.PrecisionRectangle;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.ecore.ENamedElement;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.diagram.core.commands.SetPropertyCommand;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
-import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.core.util.PackageUtil;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.commands.CommonDeferredCreateConnectionViewCommand;
-import org.eclipse.papyrus.diagram.common.commands.SemanticAdapter;
-import org.eclipse.papyrus.diagram.common.editpolicies.OldCommonDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CreateViewCommand;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomCompositeStateSetBoundsCommand;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomCompositeStateWithDefaultRegionCreateNodeCommand;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomFirstRegionInCompositeStateCreateElementCommand;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomRegionCreateElementCommand;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomRegionMoveCommand;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomStateMachineSetBoundsCommand;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomStateMachineWithDefaultRegionCreateNodeCommand;
-import org.eclipse.papyrus.diagram.statemachine.custom.edit.part.CustomRegionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.RegionFigure;
-import org.eclipse.papyrus.diagram.statemachine.custom.helpers.StateMachineLinkMappingHelper;
-import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone;
-import org.eclipse.papyrus.diagram.statemachine.custom.locators.CustomEntryExitPointPositionLocator;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.ConnectionPointReferenceEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.uml2.uml.ConnectionPointReference;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Pseudostate;
-import org.eclipse.uml2.uml.PseudostateKind;
-import org.eclipse.uml2.uml.Region;
-import org.eclipse.uml2.uml.State;
-import org.eclipse.uml2.uml.StateMachine;
-import org.eclipse.uml2.uml.Transition;
-import org.eclipse.uml2.uml.Vertex;
-
-public class CustomStateMachineDiagramDragDropEditPolicy extends OldCommonDiagramDragDropEditPolicy {
-
- IFigure sizeOnDropFeedback = null;
-
- String dropLocation = Zone.RIGHT;
-
- boolean fromOutline = false;
-
- /**
- * Instantiates a new state machine diagram drag drop edit policy with the
- * right link mapping helper
- */
- public CustomStateMachineDiagramDragDropEditPolicy() {
- super(StateMachineLinkMappingHelper.getInstance());
- }
-
- /**
- * <pre>
- * Returns the drop command for Affixed nodes (Pseudostate entry/exitPoint, ConnectionPointReference).
- * </pre>
- *
- * @param dropRequest
- * the drop request
- * @param location
- * the location to drop the element
- * @param droppedElement
- * the element to drop
- * @param nodeVISUALID
- * the visual identifier of the EditPart of the dropped element
- * @return the drop command
- */
- protected Command dropAffixedNode(DropObjectsRequest dropRequest, Element droppedElement, int nodeVISUALID) {
-
- // The dropped element must be a Pseudostate or ConnectionPointReference
- if(!((droppedElement instanceof Pseudostate) || (droppedElement instanceof ConnectionPointReference))) {
- return UnexecutableCommand.INSTANCE;
- }
-
- if(droppedElement instanceof Pseudostate) {
- Pseudostate ps = (Pseudostate)droppedElement;
- // The dropped element must be an entry or exitPoint
- PseudostateKind kind = ps.getKind();
- if(!(kind.equals(PseudostateKind.ENTRY_POINT_LITERAL) || kind.equals(PseudostateKind.EXIT_POINT_LITERAL))) {
- return UnexecutableCommand.INSTANCE;
- }
- }
-
- // Manage Element drop in compartment
- Boolean isCompartmentTarget = false; // True if the target is a ShapeCompartmentEditPart
- GraphicalEditPart graphicalParentEditPart = (GraphicalEditPart)getHost();
-
- // Default drop location
- Point dropLocation = dropRequest.getLocation().getCopy();
-
- // Detect if the drop target is a compartment
- if(graphicalParentEditPart instanceof RegionCompartmentEditPart) {
- isCompartmentTarget = true;
-
- RegionFigure regionFigure = (RegionFigure)((RegionEditPart)graphicalParentEditPart.getParent()).getPrimaryShape();
-
- // Replace compartment edit part by its ancestor StateMachineEditPart or StateEditPart
- graphicalParentEditPart = (GraphicalEditPart)graphicalParentEditPart.getParent().getParent().getParent();
-
- dropLocation.translate(regionFigure.getLocation());
- if(graphicalParentEditPart instanceof StateMachineEditPart) {
- regionFigure.translateToAbsolute(dropLocation);
- }
- } else if(graphicalParentEditPart instanceof StateCompartmentEditPart) {
- isCompartmentTarget = true;
- // Replace compartment edit part by its ancestor StateMachineEditPart or StateEditPart
- graphicalParentEditPart = (GraphicalEditPart)graphicalParentEditPart.getParent();
- }
- // Manage Element drop in compartment
-
- // Create proposed creation bounds and use the locator to find the expected position
- Point parentLoc = graphicalParentEditPart.getFigure().getBounds().getLocation().getCopy();
-
- CustomEntryExitPointPositionLocator locator = new CustomEntryExitPointPositionLocator(graphicalParentEditPart.getFigure(), PositionConstants.NONE);
-
- Rectangle proposedBounds = new Rectangle(dropLocation, new Dimension(20, 20));
- Rectangle preferredBounds = locator.getPreferredLocation(proposedBounds);
-
- // Convert the calculated preferred bounds as relative to parent location
- Rectangle creationBounds = preferredBounds.getTranslated(parentLoc.getNegated());
- if(graphicalParentEditPart instanceof StateMachineEditPart) {
- dropLocation = creationBounds.getLocation();
- }
-
- EObject graphicalParentObject = graphicalParentEditPart.resolveSemanticElement();
-
- if((graphicalParentObject instanceof StateMachine) && (((StateMachine)graphicalParentObject).getConnectionPoints().contains((Pseudostate)droppedElement))) {
- // Drop Pseudostate on StateMachine
- if(isCompartmentTarget) {
- return getDropAffixedNodeInCompartmentCommand(nodeVISUALID, dropLocation, droppedElement);
- }
- return new ICommandProxy(getDefaultDropNodeCommand(nodeVISUALID, dropLocation, droppedElement));
-
- }
- if(graphicalParentObject instanceof State) {
- if((droppedElement instanceof Pseudostate) && (((State)graphicalParentObject).getConnectionPoints().contains((Pseudostate)droppedElement)) || (droppedElement instanceof ConnectionPointReference) && (((State)graphicalParentObject).getConnections().contains((ConnectionPointReference)droppedElement))) {
- // Drop Pseudostate or ConnectionPointReference on State
- if(isCompartmentTarget) {
- return getDropAffixedNodeInCompartmentCommand(nodeVISUALID, dropLocation, droppedElement);
- }
- return new ICommandProxy(getDefaultDropNodeCommand(nodeVISUALID, dropLocation, droppedElement));
- }
- }
-
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * Returns the drop command for StateMachine nodes.
- *
- * @param dropRequest
- * the drop request
- * @param location
- * the location to drop the element
- * @param droppedElement
- * the element to drop
- * @param nodeVISUALID
- * the visual identifier of the EditPart of the dropped element
- * @return the drop command
- */
- protected Command dropRegion(DropObjectsRequest dropRequest, Region droppedElement, int nodeVISUALID) {
-
- GraphicalEditPart graphicalParentEditPart = (GraphicalEditPart)getHost();
- EObject graphicalParentObject = graphicalParentEditPart.resolveSemanticElement();
-
- if(graphicalParentObject instanceof Region) {
- Region region = (Region)graphicalParentObject;
-
-
- if(((region.getStateMachine() != null) && region.getStateMachine().getRegions().contains(droppedElement) && !region.equals(droppedElement)) || ((region.getState() != null) && region.getState().getRegions().contains(droppedElement) && !region.equals(droppedElement))) {
- CompositeCommand cc = new CompositeCommand("Drop");
- // get an adaptable for the dropped region
- IAdaptable adaptableForDroppedRegion = (IAdaptable)new SemanticAdapter(droppedElement, null);
- // get the existing region view
- View existingRegionView = (View)graphicalParentEditPart.getParent().getModel();
- // get and adaptable for it, to pass on to commands
- IAdaptable adaptableForExistingRegionView = (IAdaptable)new SemanticAdapter(null, existingRegionView);
-
- // check whether the dropped region is already shown in the state
- // machine or state compartment
- View compartment = (View)existingRegionView.eContainer();
- View alreadyShown = null;
- Iterator<View> it = compartment.getChildren().iterator();
- while((alreadyShown == null) && it.hasNext()) {
- View current = it.next();
- if(current.getElement().equals(droppedElement)) {
- alreadyShown = current;
- }
- }
- if(alreadyShown != null) {
- if(fromOutline) {
- return UnexecutableCommand.INSTANCE;
- }
-
- IAdaptable adaptableForRegionToMove = (IAdaptable)new SemanticAdapter(null, alreadyShown);
-
- // specific command to move the already shown region
- CustomRegionMoveCommand moveCommand = new CustomRegionMoveCommand(adaptableForExistingRegionView, adaptableForRegionToMove, ((IGraphicalEditPart)getHost()).getDiagramPreferencesHint(), getEditingDomain(), DiagramUIMessages.CreateCommand_Label, dropLocation);
- cc.compose(moveCommand);
- } else {
- // do the whole job
- CustomRegionCreateElementCommand createNewRegion = new CustomRegionCreateElementCommand(adaptableForExistingRegionView, adaptableForDroppedRegion, ((IGraphicalEditPart)getHost()).getDiagramPreferencesHint(), getEditingDomain(), DiagramUIMessages.CreateCommand_Label, dropLocation);
- cc.compose(createNewRegion);
- }
- return new ICommandProxy(cc.reduce());
- }
- }
-
- else if(graphicalParentObject instanceof State) {
- State state = (State)graphicalParentObject;
-
- if(state.getRegions().contains(droppedElement)) {
-
- // get the state view
- View stateView = (View)graphicalParentEditPart.getModel();
-
- // check whether any region is already shown in the state compartment
- if(stateView.getChildren().size() < 2)
- return UnexecutableCommand.INSTANCE;
- View compartment = (View)stateView.getChildren().get(1);
- if(!compartment.getChildren().isEmpty())
- //then do not allow the drag and drop on state, this forces the drag and drop on an displayed region (see above)
- return UnexecutableCommand.INSTANCE;
-
- CompositeCommand cc = new CompositeCommand("Drop");
- // get an adaptable for the dropped region
- IAdaptable adaptableForDroppedRegion = (IAdaptable)new SemanticAdapter(droppedElement, null);
- // get and adaptable for the compartmentView, to pass on to commands
- IAdaptable adaptableForCompartment = (IAdaptable)new SemanticAdapter(null, compartment);
-
- // do the whole job
- CustomFirstRegionInCompositeStateCreateElementCommand createNewRegion = new CustomFirstRegionInCompositeStateCreateElementCommand(adaptableForCompartment, adaptableForDroppedRegion, ((IGraphicalEditPart)getHost()).getDiagramPreferencesHint(), getEditingDomain(), DiagramUIMessages.CreateCommand_Label, dropLocation);
- SetPropertyCommand showCompartment = new SetPropertyCommand(getEditingDomain(), adaptableForCompartment, "notation.View.visible", "Visibility", true);
- cc.compose(createNewRegion);
- cc.compose(showCompartment);
-
- return new ICommandProxy(cc.reduce());
- }
-
- }
-
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * Returns the drop command for StateMachine nodes.
- *
- * @param dropRequest
- * the drop request
- * @param location
- * the location to drop the element
- * @param droppedElement
- * the element to drop
- * @param nodeVISUALID
- * the visual identifier of the EditPart of the dropped element
- * @return the drop command
- */
- protected Command dropStateMachine(DropObjectsRequest dropRequest, Point location, StateMachine droppedElement, int nodeVISUALID) {
-
- GraphicalEditPart graphicalParentEditPart = (GraphicalEditPart)getHost();
- EObject graphicalParentObject = graphicalParentEditPart.resolveSemanticElement();
-
- if((graphicalParentObject instanceof org.eclipse.uml2.uml.StateMachine)) {
- CompositeCommand cc = new CompositeCommand("Drop");
- IAdaptable elementAdapter = new EObjectAdapter(droppedElement);
-
- ViewDescriptor descriptor = new ViewDescriptor(elementAdapter, Node.class, ((IHintedType)getUMLElementType(nodeVISUALID)).getSemanticHint(), ViewUtil.APPEND, false, getDiagramPreferencesHint());
-
- CreateCommand createStateMachine = new CreateCommand(getEditingDomain(), descriptor, (View)(getHost().getModel()));
-
- CustomStateMachineWithDefaultRegionCreateNodeCommand createRegion = new CustomStateMachineWithDefaultRegionCreateNodeCommand((IAdaptable)createStateMachine.getCommandResult().getReturnValue(), ((IGraphicalEditPart)getHost()).getDiagramPreferencesHint(), getEditingDomain(), DiagramUIMessages.CreateCommand_Label, createStateMachine.getAffectedFiles());
-
- CustomStateMachineSetBoundsCommand setBoundsCommand = new CustomStateMachineSetBoundsCommand(getEditingDomain(), null, descriptor, new Rectangle(location.x, location.y, -1, -1));
-
- cc.compose(createStateMachine);
- cc.compose(createRegion);
- cc.compose(setBoundsCommand);
- return new ICommandProxy(cc.reduce());
- }
-
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * Returns the drop command for State nodes.
- *
- * @param dropRequest
- * the drop request
- * @param location
- * the location to drop the element
- * @param droppedElement
- * the element to drop
- * @param nodeVISUALID
- * the visual identifier of the EditPart of the dropped element
- * @return the drop command
- */
- protected Command dropState(DropObjectsRequest dropRequest, Point location, State droppedElement, int nodeVISUALID) {
-
- GraphicalEditPart graphicalParentEditPart = (GraphicalEditPart)getHost();
- EObject graphicalParentObject = graphicalParentEditPart.resolveSemanticElement();
-
- if((graphicalParentObject instanceof org.eclipse.uml2.uml.Region) && droppedElement.eContainer().equals(graphicalParentObject)) {
- CompositeCommand cc = new CompositeCommand("Drop");
- IAdaptable elementAdapter = new EObjectAdapter(droppedElement);
-
- ViewDescriptor descriptor = new ViewDescriptor(elementAdapter, Node.class, ((IHintedType)getUMLElementType(nodeVISUALID)).getSemanticHint(), ViewUtil.APPEND, false, getDiagramPreferencesHint());
-
- CreateCommand createState = new CreateCommand(getEditingDomain(), descriptor, (View)(getHost().getModel()));
-
- CustomCompositeStateWithDefaultRegionCreateNodeCommand createRegion = new CustomCompositeStateWithDefaultRegionCreateNodeCommand((IAdaptable)createState.getCommandResult().getReturnValue(), ((IGraphicalEditPart)getHost()).getDiagramPreferencesHint(), getEditingDomain(), DiagramUIMessages.CreateCommand_Label, createState.getAffectedFiles());
-
- CustomCompositeStateSetBoundsCommand setBoundsCommand;
-
- cc.compose(createState);
- cc.compose(createRegion);
-
- //take care of the case when a simple state is dropped, then we should provide a reasonable size
- if(droppedElement.getRegions().isEmpty()) {
- setBoundsCommand = new CustomCompositeStateSetBoundsCommand(getEditingDomain(), null, descriptor, new Rectangle(location.x, location.y, 40, 40), false);
- cc.compose(setBoundsCommand);
- } else {
- setBoundsCommand = new CustomCompositeStateSetBoundsCommand(getEditingDomain(), null, descriptor, new Rectangle(location.x, location.y, -1, -1), true);
- cc.compose(setBoundsCommand);
- //force compartment to be shown
- SetPropertyCommand showCompartment = new SetPropertyCommand(getEditingDomain(), (IAdaptable)createState.getCommandResult().getReturnValue(), "notation.View.visible", "Visibility", true) {
-
- protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
-
- View view = (View)getViewAdapter().getAdapter(View.class);
- if((view != null) && (view.getChildren().size() >= 2) && (view.getChildren().get(1) != null)) {
- ENamedElement namedElement = PackageUtil.getElement((String)getPropertyId());
- if(namedElement instanceof EStructuralFeature)
- ViewUtil.setStructuralFeatureValue((View)view.getChildren().get(1), (EStructuralFeature)namedElement, getNewValue());
- }
- return CommandResult.newOKCommandResult();
- }
-
- };
- cc.compose(showCompartment);
- }
- return new ICommandProxy(cc.reduce());
- }
-
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * Returns the drop command for Transition links.
- *
- * @param dropRequest
- * the drop request
- * @param semanticLink
- * the element to drop
- * @param linkVISUALID
- * the visual identifier of the EditPart of the dropped element
- * @return the drop command
- */
- protected Command dropTransition(DropObjectsRequest dropRequest, Transition droppedElement, int linkVISUALID) {
- //we restrict drop to be over the owning region
- GraphicalEditPart graphicalParentEditPart = (GraphicalEditPart)getHost();
- EObject graphicalParentObject = graphicalParentEditPart.resolveSemanticElement();
- if(!(graphicalParentObject instanceof Region) || !((Region)graphicalParentObject).getTransitions().contains(droppedElement)) {
- return UnexecutableCommand.INSTANCE;
- }
- Vertex source = droppedElement.getSource();
- Vertex target = droppedElement.getTarget();
-
- if((source != null) && (target != null)) {
- // look for editpart
- GraphicalEditPart sourceEditPart = (GraphicalEditPart)lookForEditPart(source);
- GraphicalEditPart targetEditPart = (GraphicalEditPart)lookForEditPart(target);
- // when the vertex are not represented on the diagram, we look for their parents.
- DiagramEditPart diagram = DiagramEditPartsUtil.getDiagramEditPart(getHost());
- // the parents of the vertex, we use them when the VertexEditPart are not on the diagram
- EditPart sourceParent = null;
- EditPart targetParent = null;
- if(sourceEditPart == null || targetEditPart == null) {
-
- List<IGraphicalEditPart> AllEP = DiagramEditPartsUtil.getAllEditParts(diagram);
- EObject srcParent = source.eContainer();
- EObject tgtParent = target.eContainer();
-
- for(IGraphicalEditPart iGraphicalEditPart : AllEP) {
- EObject object = ViewUtil.resolveSemanticElement((View)(iGraphicalEditPart).getModel());//method getHostObject
- if(object == srcParent && !(iGraphicalEditPart instanceof CompartmentEditPart)) {
- sourceParent = iGraphicalEditPart;
- }
- if(object == tgtParent && !(iGraphicalEditPart instanceof CompartmentEditPart)) {
- targetParent = iGraphicalEditPart;
- }
- if(targetParent != null && sourceParent != null) {
- sourceParent = (EditPart)sourceParent.getChildren().get(0);
- targetParent = (EditPart)targetParent.getChildren().get(0);
- break;
- }
- }
-
-
- // the parent of the vertex shall be present in the diagram otherwise we do not support drag and drop
- if((targetParent == null) || (sourceParent == null)) {
- return UnexecutableCommand.INSTANCE;
- }
- }
-
- return new ICommandProxy(dropBinaryLink(new CompositeCommand("drop Transition"), source, target, //$NON-NLS-1$
- linkVISUALID, dropRequest.getLocation(), droppedElement, sourceParent, targetParent));
- } else {
- return UnexecutableCommand.INSTANCE;
- }
- }
-
-
-
- /**
- * the method provides command to create the binary link into the diagram. If the source and the
- * target views do not exist, these views will be created.
- *
- * @param cc
- * the composite command that will contain the set of command to create the binary
- * link
- * @param source
- * the source the element source of the link
- * @param target
- * the target the element target of the link
- * @param linkVISUALID
- * the link VISUALID used to create the view
- * @param location
- * the location the location where the view will be be created
- * @param semanticLink
- * the semantic link that will be attached to the view
- * @param sourceParent
- * the editPart of the source parent
- * @param targetParent
- * the editPart of the target parent
- *
- * @return the composite command
- */
- public CompositeCommand dropBinaryLink(CompositeCommand cc, Element source, Element target, int linkVISUALID, Point location, Element semanticLink, EditPart sourceParent, EditPart targetParent) {
- // look for editpart
- GraphicalEditPart sourceEditPart = (GraphicalEditPart)lookForEditPart(source);
- GraphicalEditPart targetEditPart = (GraphicalEditPart)lookForEditPart(target);
-
- // descriptor of the link
- CreateConnectionViewRequest.ConnectionViewDescriptor linkdescriptor = new CreateConnectionViewRequest.ConnectionViewDescriptor(getUMLElementType(linkVISUALID), ((IHintedType)getUMLElementType(linkVISUALID)).getSemanticHint(), getDiagramPreferencesHint());
-
- IAdaptable sourceAdapter = null;
- IAdaptable targetAdapter = null;
- if(sourceEditPart == null) {
- // creation of the node
- ViewDescriptor descriptor = new ViewDescriptor(new EObjectAdapter(source), Node.class, null, ViewUtil.APPEND, false, ((IGraphicalEditPart)getHost()).getDiagramPreferencesHint());
-
- // get the command and execute it.
- CreateCommand nodeCreationCommand = new CreateCommand(((IGraphicalEditPart)getHost()).getEditingDomain(), descriptor, (View)sourceParent.getModel());
- cc.compose(nodeCreationCommand);
- SetBoundsCommand setBoundsCommand = new SetBoundsCommand(getEditingDomain(), "move", (IAdaptable)nodeCreationCommand.getCommandResult().getReturnValue(), new Point(location.x, location.y + 30)); //$NON-NLS-1$
- cc.compose(setBoundsCommand);
-
- sourceAdapter = (IAdaptable)nodeCreationCommand.getCommandResult().getReturnValue();
- } else {
- sourceAdapter = new SemanticAdapter(null, sourceEditPart.getModel());
- }
- //additional check to ensure we do not create twice the same node when links are "loops" on the same element
- if((target != null) && !target.equals(source)) {
- if(targetEditPart == null) {
- // creation of the node
- ViewDescriptor descriptor = new ViewDescriptor(new EObjectAdapter(target), Node.class, null, ViewUtil.APPEND, false, ((IGraphicalEditPart)getHost()).getDiagramPreferencesHint());
-
- // get the command and execute it.
- CreateCommand nodeCreationCommand = new CreateCommand(((IGraphicalEditPart)getHost()).getEditingDomain(), descriptor, ((View)targetParent.getModel()));
- cc.compose(nodeCreationCommand);
- //take care of the location for the cases when the target is not in the same container as the source
- SetBoundsCommand setBoundsCommand;
- if((targetParent != null) && !targetParent.equals(sourceParent)) {
- setBoundsCommand = new SetBoundsCommand(getEditingDomain(), "move", (IAdaptable)nodeCreationCommand.getCommandResult().getReturnValue(), new Point(10, 10)); //$NON-NLS-1$
- } else {
- setBoundsCommand = new SetBoundsCommand(getEditingDomain(), "move", (IAdaptable)nodeCreationCommand.getCommandResult().getReturnValue(), new Point(location.x, location.y - 30)); //$NON-NLS-1$
- }
- cc.compose(setBoundsCommand);
- targetAdapter = (IAdaptable)nodeCreationCommand.getCommandResult().getReturnValue();
-
- } else {
- targetAdapter = new SemanticAdapter(null, targetEditPart.getModel());
- }
- }
- //in case of loop links (see above) we pass on the same adapter for both source and target
- if((target != null) && target.equals(source)) {
- targetAdapter = sourceAdapter;
- }
-
- CommonDeferredCreateConnectionViewCommand aLinkCommand = new CommonDeferredCreateConnectionViewCommand(getEditingDomain(), ((IHintedType)getUMLElementType(linkVISUALID)).getSemanticHint(), sourceAdapter, targetAdapter, getViewer(), getDiagramPreferencesHint(), linkdescriptor, null);
- aLinkCommand.setElement(semanticLink);
- cc.compose(aLinkCommand);
- return cc;
-
- }
-
-
-
- @Override
- public void eraseTargetFeedback(Request request) {
- if(sizeOnDropFeedback != null) {
- removeFeedback(sizeOnDropFeedback);
- sizeOnDropFeedback = null;
- }
- }
-
- /**
- * <pre>
- * This method returns the drop command for AffixedNode (Pseudostate, ConnectionPointReference)
- * in case the node is dropped on a ShapeCompartmentEditPart.
- * </pre>
- *
- * @param nodeVISUALID
- * the node visual identifier
- * @param location
- * the drop location
- * @param droppedObject
- * the object to drop
- * @return a CompositeCommand for Drop
- */
- protected CompoundCommand getDropAffixedNodeInCompartmentCommand(int nodeVISUALID, Point location, EObject droppedObject) {
- CompoundCommand cc = new CompoundCommand("Drop");
- IAdaptable elementAdapter = new EObjectAdapter(droppedObject);
-
- ViewDescriptor descriptor = new ViewDescriptor(elementAdapter, Node.class, ((IHintedType)getUMLElementType(nodeVISUALID)).getSemanticHint(), ViewUtil.APPEND, false, getDiagramPreferencesHint());
- // Create the command targeting host parent (owner of the ShapeCompartmentEditPart)
- CreateViewCommand createCommand = null;
- if(nodeVISUALID != ConnectionPointReferenceEditPart.VISUAL_ID) {
- createCommand = new CreateViewCommand(getEditingDomain(), descriptor, ((View)(getHost().getParent().getParent().getParent().getModel())));
- cc.add(new ICommandProxy(createCommand));
- } else {
- createCommand = new CreateViewCommand(getEditingDomain(), descriptor, ((View)(getHost().getParent().getModel())));
- cc.add(new ICommandProxy(createCommand));
- }
-
- SetBoundsCommand setBoundsCommand = new SetBoundsCommand(getEditingDomain(), "move", (IAdaptable)createCommand.getCommandResult().getReturnValue(), location);
- cc.add(new ICommandProxy(setBoundsCommand));
-
- return cc;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Set<Integer> getDroppableElementVisualId() {
- Set<Integer> droppableElementsVisualId = new HashSet<Integer>();
- droppableElementsVisualId.add(StateMachineEditPart.VISUAL_ID);
- droppableElementsVisualId.add(StateEditPart.VISUAL_ID);
- droppableElementsVisualId.add(RegionEditPart.VISUAL_ID);
- droppableElementsVisualId.add(PseudostateEntryPointEditPart.VISUAL_ID);
- droppableElementsVisualId.add(PseudostateExitPointEditPart.VISUAL_ID);
- droppableElementsVisualId.add(ConnectionPointReferenceEditPart.VISUAL_ID);
- droppableElementsVisualId.add(TransitionEditPart.VISUAL_ID);
- return droppableElementsVisualId;
- }
-
- @Override
- public int getLinkWithClassVisualID(EObject domainElement) {
- return UMLVisualIDRegistry.getLinkWithClassVisualID(domainElement);
- }
-
- @Override
- public int getNodeVisualID(View containerView, EObject domainElement) {
- if((domainElement instanceof Region) && (containerView.getElement() instanceof Region)) {
- return RegionEditPart.VISUAL_ID;
- }
- return UMLVisualIDRegistry.getNodeVisualID(containerView, domainElement);
- }
-
- protected IFigure getSizeOnDropFeedback() {
- if(sizeOnDropFeedback == null) {
- sizeOnDropFeedback = new RectangleFigure();
- FigureUtilities.makeGhostShape((Shape)sizeOnDropFeedback);
- ((Shape)sizeOnDropFeedback).setLineStyle(Graphics.LINE_DASHDOT);
- sizeOnDropFeedback.setForegroundColor(ColorConstants.white);
- addFeedback(sizeOnDropFeedback);
- }
- return sizeOnDropFeedback;
- }
-
- /**
- * {@inheritedDoc}
- */
- protected Command getSpecificDropCommand(DropObjectsRequest dropRequest, Element semanticElement, int nodeVISUALID, int linkVISUALID) {
-
- // Retrieve drop location
- Point location = dropRequest.getLocation().getCopy();
-
- // Switch test over linkVisualID
- switch(linkVISUALID) {
- case TransitionEditPart.VISUAL_ID:
- return dropTransition(dropRequest, (Transition)semanticElement, linkVISUALID);
- default:
- // Switch test over nodeVISUALID
- switch(nodeVISUALID) {
- case StateMachineEditPart.VISUAL_ID:
- return dropStateMachine(dropRequest, location, (StateMachine)semanticElement, nodeVISUALID);
- case StateEditPart.VISUAL_ID:
- return dropState(dropRequest, location, (State)semanticElement, nodeVISUALID);
- case RegionEditPart.VISUAL_ID:
- return dropRegion(dropRequest, (Region)semanticElement, nodeVISUALID);
- case PseudostateEntryPointEditPart.VISUAL_ID:
- case PseudostateExitPointEditPart.VISUAL_ID:
- case ConnectionPointReferenceEditPart.VISUAL_ID:
- return dropAffixedNode(dropRequest, semanticElement, nodeVISUALID);
-
- default:
- return super.getSpecificDropCommand(dropRequest, semanticElement, nodeVISUALID, linkVISUALID);
- }
- }
- }
-
- @Override
- public IElementType getUMLElementType(int elementID) {
- return UMLElementTypes.getElementType(elementID);
- }
-
- @Override
- public void showTargetFeedback(Request request) {
- if((request instanceof ChangeBoundsRequest) && !REQ_RESIZE.equals(request.getType())) {
- fromOutline = false;
- ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
- for(Iterator iter = changeBoundsRequest.getEditParts().iterator(); iter.hasNext();) {
- GraphicalEditPart element = (GraphicalEditPart)iter.next();
- if(element instanceof RegionEditPart) {
- CustomRegionEditPart regionEditPart = (CustomRegionEditPart)element;
-
- View compartment = (View)((View)element.getModel()).eContainer();
- if(compartment.getChildren().size() == 1)
- return;
-
- CustomRegionDragTracker dragTracker = regionEditPart.getRegionDragTracker();
- RegionEditPart targetEP = dragTracker.getTargetRegionEditPart();
- if(targetEP != null) {
- RegionFigure targetFig = targetEP.getPrimaryShape();
-
- // make a local copy
- Rectangle targetFigBounds = targetFig.getBounds().getCopy();
- // transform the coordinates to absolute
- targetFig.translateToAbsolute(targetFigBounds);
- // retrieve mouse location
- Point mouseLocation = changeBoundsRequest.getLocation();
-
- // get the drop location, i.e. RIGHT, LEFT, TOP, BOTTOM
- dropLocation = Zone.getZoneFromLocationInRectangleWithAbsoluteCoordinates(mouseLocation, targetFigBounds);
-
- // perform corresponding change (scaling, translation)
- // on
- // targetFigBounds
- // and updates the graph node drop location property
- if(Zone.isTop(dropLocation)) {
- targetFigBounds.setSize(targetFigBounds.getSize().scale(1.0, 0.5));
- } else if(Zone.isLeft(dropLocation)) {
- targetFigBounds.setSize(targetFigBounds.getSize().scale(0.5, 1.0));
- } else if(Zone.isRight(dropLocation)) {
- targetFigBounds.setSize(targetFigBounds.getSize().scale(0.5, 1.0));
- targetFigBounds.translate(targetFigBounds.width, 0);
- } else if(Zone.isBottom(dropLocation)) {
- targetFigBounds.setSize(targetFigBounds.getSize().scale(1.0, 0.5));
- targetFigBounds.translate(0, targetFigBounds.height);
- }
-
- getSizeOnDropFeedback().setBounds(new PrecisionRectangle(targetFigBounds));
- } else {
-
- Rectangle targetFigBounds = dragTracker.getRegionFigureBounds();
-
- // retrieve mouse move
- Point mouseMove = changeBoundsRequest.getMoveDelta();
-
- targetFigBounds.translate(mouseMove);
-
- getSizeOnDropFeedback().setBounds(new PrecisionRectangle(targetFigBounds));
- }
- }
- }
- }
- if(request instanceof DropObjectsRequest) {
- fromOutline = true;
- DropObjectsRequest dropRequest = (DropObjectsRequest)request;
- for(Iterator iter = dropRequest.getObjects().iterator(); iter.hasNext();) {
- EObject element = (EObject)iter.next();
- if((element instanceof Region) && (getHost().getParent() instanceof RegionEditPart)) {
- // check whether the dropped region is already shown in the
- // state machine
- View compartment = null;
- if(getHost().getParent().getParent() instanceof StateMachineCompartmentEditPart)
- compartment = (View)((StateMachineCompartmentEditPart)getHost().getParent().getParent()).getModel();
- else if(getHost().getParent().getParent() instanceof StateCompartmentEditPart)
- compartment = (View)((StateCompartmentEditPart)getHost().getParent().getParent()).getModel();
- View alreadyShown = null;
- Iterator<View> it = compartment.getChildren().iterator();
- while((alreadyShown == null) && it.hasNext()) {
- View current = it.next();
- if(current.getElement().equals(element)) {
- alreadyShown = current;
- }
- }
- if(alreadyShown == null) {
- RegionFigure targetFig = ((RegionEditPart)getHost().getParent()).getPrimaryShape();
-
- // make a local copy
- Rectangle targetFigBounds = targetFig.getBounds().getCopy();
- // transform the coordinates to absolute
- targetFig.translateToAbsolute(targetFigBounds);
- // retrieve mouse location
- Point mouseLocation = dropRequest.getLocation().getCopy();
-
- // get the drop location, i.e. RIGHT, LEFT, TOP, BOTTOM
- dropLocation = Zone.getZoneFromLocationInRectangleWithAbsoluteCoordinates(mouseLocation, targetFigBounds);
-
- // perform corresponding change (scaling, translation)
- // on
- // targetFigBounds
- // and updates the graph node drop location property
- if(Zone.isTop(dropLocation)) {
- targetFigBounds.setSize(targetFigBounds.getSize().scale(1.0, 0.5));
- } else if(Zone.isLeft(dropLocation)) {
- targetFigBounds.setSize(targetFigBounds.getSize().scale(0.5, 1.0));
- } else if(Zone.isRight(dropLocation)) {
- targetFigBounds.setSize(targetFigBounds.getSize().scale(0.5, 1.0));
- targetFigBounds.translate(targetFigBounds.width, 0);
- } else if(Zone.isBottom(dropLocation)) {
- targetFigBounds.setSize(targetFigBounds.getSize().scale(1.0, 0.5));
- targetFigBounds.translate(0, targetFigBounds.height);
- }
-
- getSizeOnDropFeedback().setBounds(new PrecisionRectangle(targetFigBounds));
- }
- }
- }
- }
- }
-
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateMachineLayoutEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateMachineLayoutEditPolicy.java
deleted file mode 100644
index 0bfb5d3f2d0..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/CustomStateMachineLayoutEditPolicy.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.policies;
-
-import java.util.Iterator;
-
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-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.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.editpolicies.BorderItemResizableEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.custom.locators.CustomEntryExitPointPositionLocator;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-
-/**
- * This edit policy replaces the GMF generated edit policy for StateMachine(s).
- * In particular it provides a getCreateCommands that add a ChangeBoundRequest on a created Entry/ExitPoint
- * in order to locate it at the cursor position.
- */
-public class CustomStateMachineLayoutEditPolicy extends LayoutEditPolicy {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View)child.getModel();
- switch(UMLVisualIDRegistry.getVisualID(childView)) {
- case PseudostateEntryPointEditPart.VISUAL_ID:
- case PseudostateExitPointEditPart.VISUAL_ID:
-
- return new BorderItemResizableEditPolicy();
-
- }
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- public Command getCommand(Request request) {
- // TODO Auto-generated method stub
- return super.getCommand(request);
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- if(request instanceof CreateViewAndElementRequest) {
-
- CreateViewAndElementRequest req = (CreateViewAndElementRequest)request;
-
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
-
- CompositeTransactionalCommand cc = new CompositeTransactionalCommand(editingDomain, DiagramUIMessages.AddCommand_Label);
- Iterator<?> iter = req.getViewDescriptors().iterator();
-
- // Retrieve parent location
- Point parentLoc = getHostFigure().getBounds().getLocation().getCopy();
-
- // Compute relative creation location
- Point requestedLocation = request.getLocation().getCopy();
- getHostFigure().translateToRelative(requestedLocation);
-
- // Create proposed creation bounds and use the locator to find the expected position
- CustomEntryExitPointPositionLocator locator = new CustomEntryExitPointPositionLocator(getHostFigure(), PositionConstants.NONE);
- Rectangle proposedBounds = new Rectangle(requestedLocation, new Dimension(20, 20));
- Rectangle preferredBounds = locator.getPreferredLocation(proposedBounds);
-
- // Convert the calculated preferred bounds as relative to parent location
- Rectangle creationBounds = preferredBounds.getTranslated(parentLoc.getNegated());
-
- while(iter.hasNext()) {
-
- CreateViewRequest.ViewDescriptor viewDescriptor = (CreateViewRequest.ViewDescriptor)iter.next();
- cc.compose(new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, viewDescriptor, creationBounds));
- }
-
- if(cc.reduce() == null)
- return null;
-
- return new ICommandProxy(cc.reduce());
- }
- return null;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/RemoveOrphanViewPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/RemoveOrphanViewPolicy.java
deleted file mode 100644
index f9eb81eff8a..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/policies/RemoveOrphanViewPolicy.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2008 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.diagram.statemachine.custom.policies;
-
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.editpolicies.OrphanViewPolicy;
-import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomRegionDeleteCommand;
-import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone;
-
-/**
- * this policy is used to supress orphan node view in GMF view the prolicy to
- * remove orphan connection is more complex. It is dependent of the diagram. see
- * remove OrphanConnectionView policy in clazzdiagram
- *
- */
-public class RemoveOrphanViewPolicy extends OrphanViewPolicy {
-
- public int[] notOrphanNode = { 3002, 2002, 6002 };
-
- public RemoveOrphanViewPolicy() {
- super();
- init(notOrphanNode);
- }
-
- @Override
- protected Command getDeleteViewCommand(View view) {
- if(Zone.isRegion(view)) {
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
- return new ICommandProxy(new CustomRegionDeleteCommand(editingDomain, view));
- }
- return super.getDeleteViewCommand(view);
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/preferences/CustomStatePreferencePage.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/preferences/CustomStatePreferencePage.java
deleted file mode 100644
index c7f1329bae5..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/preferences/CustomStatePreferencePage.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.preferences;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.diagram.statemachine.preferences.StatePreferencePage;
-import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
-
-public class CustomStatePreferencePage extends StatePreferencePage {
-
- public static void initDefaults(IPreferenceStore store) {
-
- String key = PackageEditPart.MODEL_ID + "_State";
- store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 40);
- store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 40);
-
- for(String name : compartments) {
- String preferenceName = PreferenceConstantHelper.getCompartmentElementConstant(key, name, PreferenceConstantHelper.COMPARTMENT_VISIBILITY);
- store.setDefault(preferenceName, false);
- }
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/providers/CustomUMLEditPartProvider.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/providers/CustomUMLEditPartProvider.java
deleted file mode 100644
index 66d071631ac..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/providers/CustomUMLEditPartProvider.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.custom.providers;
-
-import org.eclipse.papyrus.diagram.statemachine.custom.factory.CustomUMLEditPartFactory;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLEditPartProvider;
-
-public class CustomUMLEditPartProvider extends UMLEditPartProvider {
-
- public CustomUMLEditPartProvider() {
- setFactory(new CustomUMLEditPartFactory());
- setAllowCaching(true);
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/icons/UMLDiagramFile.gif b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/icons/UMLDiagramFile.gif
deleted file mode 100644
index de938070dea..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/icons/UMLDiagramFile.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/icons/obj16/Diagram_StateMachine.gif b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/icons/obj16/Diagram_StateMachine.gif
deleted file mode 100644
index baad798f9c6..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/icons/obj16/Diagram_StateMachine.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/icons/wizban/NewUMLWizard.gif b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/icons/wizban/NewUMLWizard.gif
deleted file mode 100644
index 83e03bf39bf..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/icons/wizban/NewUMLWizard.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/messages.properties b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/messages.properties
deleted file mode 100644
index c192307df9e..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/messages.properties
+++ /dev/null
@@ -1,90 +0,0 @@
-
-UMLCreationWizardTitle=New PapyrusUMLStateMachineDiagram Diagram
-UMLCreationWizard_DiagramModelFilePageTitle=Create PapyrusUMLStateMachineDiagram Diagram
-UMLCreationWizard_DiagramModelFilePageDescription=Select file that will contain diagram model.
-UMLCreationWizard_DomainModelFilePageTitle=Create PapyrusUMLStateMachineDiagram Domain Model
-UMLCreationWizard_DomainModelFilePageDescription=Select file that will contain domain model.
-UMLCreationWizardOpenEditorError=Error opening diagram editor
-UMLCreationWizardCreationError=Creation Problems
-UMLCreationWizardPageExtensionError=File name should have {0} extension.
-UMLDiagramEditorUtil_OpenModelResourceErrorDialogTitle=Error
-UMLDiagramEditorUtil_OpenModelResourceErrorDialogMessage=Failed to load model file {0}
-UMLDiagramEditorUtil_CreateDiagramProgressTask=Creating diagram and model files
-UMLDiagramEditorUtil_CreateDiagramCommandLabel=Creating diagram and model
-UMLDocumentProvider_isModifiable=Updating cache failed
-UMLDocumentProvider_handleElementContentChanged=Failed to refresh hierarchy for changed resource
-UMLDocumentProvider_IncorrectInputError={1}
-UMLDocumentProvider_NoDiagramInResourceError=Diagram is not present in resource
-UMLDocumentProvider_DiagramLoadingError=Error loading diagram
-UMLDocumentProvider_UnsynchronizedFileSaveError=The file has been changed on the file system
-UMLDocumentProvider_SaveDiagramTask=Saving diagram
-UMLDocumentProvider_SaveNextResourceTask=Saving {0}
-UMLDocumentProvider_SaveAsOperation=Saving {0} diagram as
-InitDiagramFile_ResourceErrorDialogTitle=Error
-InitDiagramFile_ResourceErrorDialogMessage=Model file loading failed
-InitDiagramFile_WizardTitle=Initialize new {0} diagram file
-InitDiagramFile_OpenModelFileDialogTitle=Select domain model
-UMLNewDiagramFileWizard_CreationPageName=Initialize new diagram file
-UMLNewDiagramFileWizard_CreationPageTitle=Diagram file
-UMLNewDiagramFileWizard_CreationPageDescription=Create new diagram based on {0} model content
-UMLNewDiagramFileWizard_RootSelectionPageName=Select diagram root element
-UMLNewDiagramFileWizard_RootSelectionPageTitle=Diagram root element
-UMLNewDiagramFileWizard_RootSelectionPageDescription=Select semantic model element to be depicted on diagram
-UMLNewDiagramFileWizard_RootSelectionPageSelectionTitle=Select diagram root element:
-UMLNewDiagramFileWizard_RootSelectionPageNoSelectionMessage=Diagram root element is not selected
-UMLNewDiagramFileWizard_RootSelectionPageInvalidSelectionMessage=Invalid diagram root element is selected
-UMLNewDiagramFileWizard_InitDiagramCommand=Initializing diagram contents
-UMLNewDiagramFileWizard_IncorrectRootError=Incorrect model object stored as a root resource object
-UMLDiagramEditor_SavingDeletedFile=The original file "{0}" has been deleted.
-UMLDiagramEditor_SaveAsErrorTitle=Problem During Save As...
-UMLDiagramEditor_SaveAsErrorMessage=Save could not be completed. Target file is already open in another editor.
-UMLDiagramEditor_SaveErrorTitle=Save Problems
-UMLDiagramEditor_SaveErrorMessage=Could not save file.
-UMLElementChooserDialog_SelectModelElementTitle=Select model element
-ModelElementSelectionPageMessage=Select model element:
-ValidateActionMessage=Validate
-createNodesGroup_title=Nodes
-createEdgesGroup_title=Edges
-createRegionCreationTool_title=Region
-createRegionCreationTool_desc=Region
-createStateCreationTool_title=State
-createStateCreationTool_desc=State
-createFinalStateCreationTool_title=FinalState
-createFinalStateCreationTool_desc=FinalState
-createInitialCreationTool_title=Initial
-createInitialCreationTool_desc=Initial
-createShallowHistoryCreationTool_title=ShallowHistory
-createShallowHistoryCreationTool_desc=ShallowHistory
-createDeepHistoryCreationTool_title=DeepHistory
-createDeepHistoryCreationTool_desc=DeepHistory
-createJoinCreationTool_title=Join
-createJoinCreationTool_desc=Join
-createForkCreationTool_title=Fork
-createForkCreationTool_desc=Fork
-createJunctionCreationTool_title=Junction
-createJunctionCreationTool_desc=Junction
-createChoiceCreationTool_title=Choice
-createChoiceCreationTool_desc=Choice
-createEntryPointCreationTool_title=EntryPoint
-createEntryPointCreationTool_desc=EntryPoint
-createExitPointCreationTool_title=ExitPoint
-createExitPointCreationTool_desc=ExitPoint
-createTerminateCreationTool_title=Terminate
-createTerminateCreationTool_desc=Terminate
-createTransitionCreationTool_title=Transition
-createTransitionCreationTool_desc=Transition
-RegionCompartmentEditPart_title=RegionCompartment
-StateMachineCompartmentEditPart_title=StateMachineCompartment
-CommandName_OpenDiagram=Open Diagram
-NavigatorActionProvider_OpenDiagramActionName=Open Diagram
-AbstractParser_UnexpectedValueType=Value of type {0} is expected
-AbstractParser_WrongStringConversion=String value does not convert to {0} value
-AbstractParser_UnknownLiteral=Unknown literal: {0}
-MessageFormatParser_InvalidInputError=Invalid input at {0}
-UMLModelingAssistantProviderTitle=Select domain model element
-UMLModelingAssistantProviderMessage=Available domain model elements:
-StateCompartmentEditPart_title=StateCompartment
-createConnectionPointReferenceCreationTool_title=ConnectionPointReference
-createConnectionPointReferenceCreationTool_desc=ConnectionPointReference
-createGeneralizationCreationTool_title=Generalization
-createGeneralizationCreationTool_desc=Generalization
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/model/stateMachineDiagram.gmfgen b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/model/stateMachineDiagram.gmfgen
deleted file mode 100644
index 203ac29522e..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/model/stateMachineDiagram.gmfgen
+++ /dev/null
@@ -1,2169 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xmi:XMI xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:gmfgen="http://www.eclipse.org/gmf/2009/GenModel"
- xmlns:papyrusgmfgenextension="http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension">
- <gmfgen:GenEditorGenerator
- packageNamePrefix="org.eclipse.papyrus.diagram.statemachine"
- modelID="PapyrusUMLStateMachineDiagram"
- diagramFileExtension="PapyrusUMLStateMachine_diagram"
- domainFileExtension="PapyrusUMLStateMachine"
- dynamicTemplates="true"
- templateDirectory="/org.eclipse.papyrus.def/dynamic-templates3.5/codegen">
- <diagram
- visualID="1000"
- editPartClassName="PackageEditPart"
- itemSemanticEditPolicyClassName="PackageItemSemanticEditPolicy"
- canonicalEditPolicyClassName="PackageCanonicalEditPolicy"
- iconProviderPriority="Low"
- creationWizardIconPath="icons/UMLDiagramFile.gif"
- creationWizardCategoryID="org.eclipse.ui.Examples"
- editingDomainID="org.eclipse.papyrus.diagram.statemachine.EditingDomain"
- validationEnabled="true"
- validationDecorators="true"
- liveValidationUIFeedback="true">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Diagram"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- uniqueIdentifier="org.eclipse.papyrus.diagram.statemachine.Package_1000"
- editHelperClassName="PackageEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.draw2d.FreeformLayer"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;RemoveOrphanView&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.policies.RemoveOrphanViewPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomPackageCreationEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomPackageXYLayoutEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateMachineDiagramDragDropEditPolicy"/>
- <domainDiagramElement
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package"/>
- <childNodes
- visualID="3000"
- editPartClassName="RegionEditPart"
- itemSemanticEditPolicyClassName="RegionItemSemanticEditPolicy"
- canonicalEditPolicyClassName="RegionCanonicalEditPolicy"
- compartments="/0/@diagram/@compartments.0"
- graphicalNodeEditPolicyClassName="RegionGraphicalNodeEditPolicy"
- createCommandClassName="RegionCreateCommand"
- containers="/0/@diagram/@compartments.1 /0/@diagram/@compartments.2 /0/@diagram/@childNodes.2">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- editHelperClassName="RegionEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.figures.RegionFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomRegionItemSemanticEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.COMPONENT_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomRegionComponentEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Region"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/StateMachine/region"/>
- <childMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/StateMachine/region"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- </childNodes>
- <childNodes
- visualID="5000"
- editPartClassName="FinalStateEditPart"
- itemSemanticEditPolicyClassName="FinalStateItemSemanticEditPolicy"
- canonicalEditPolicyClassName="FinalStateCanonicalEditPolicy"
- graphicalNodeEditPolicyClassName="FinalStateGraphicalNodeEditPolicy"
- createCommandClassName="FinalStateCreateCommand"
- containers="/0/@diagram/@compartments.0">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- uniqueIdentifier="org.eclipse.papyrus.diagram.statemachine.FinalState_5000"
- displayName="FinalState"
- editHelperClassName="FinalStateEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.figures.FinalStateFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="16"
- height="16"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/FinalState"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Region/subvertex"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="5001"
- editPartClassName="FinalStateNameEditPart"
- itemSemanticEditPolicyClassName="FinalStateNameItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"
- y="3"/>
- </viewmap>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.0">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="5002"
- editPartClassName="FinalStateStereotypeEditPart"
- itemSemanticEditPolicyClassName="FinalStateStereotypeItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"
- y="-10"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.1"
- viewPattern=""
- editorPattern="&lt;&lt;0>>"
- editPattern="&lt;&lt;0>>">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </childNodes>
- <childNodes
- visualID="6000"
- editPartClassName="StateEditPart"
- itemSemanticEditPolicyClassName="StateItemSemanticEditPolicy"
- canonicalEditPolicyClassName="StateCanonicalEditPolicy"
- childNodes="/0/@diagram/@childNodes.0 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.13"
- compartments="/0/@diagram/@compartments.2"
- graphicalNodeEditPolicyClassName="StateGraphicalNodeEditPolicy"
- createCommandClassName="StateCreateCommand"
- containers="/0/@diagram/@compartments.0">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- uniqueIdentifier="org.eclipse.papyrus.diagram.statemachine.State_6000"
- displayName="State"
- editHelperClassName="StateEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.figures.StateFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateLayoutEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateMachineDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateCreationEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AffixedNodeAlignmentEditPolicy.AFFIXED_CHILD_ALIGNMENT_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AffixedNodeAlignmentEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateItemSemanticEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.NavigationEditPolicy.NAVIGATION_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.NavigationEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/State"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Region/subvertex"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- visualID="6001"
- editPartClassName="StateNameEditPart"
- itemSemanticEditPolicyClassName="StateNameItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getNameLabel"
- figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
- <attributes
- xsi:type="gmfgen:StyleAttributes"
- fixedFont="true"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.NavigationEditPolicy.NAVIGATION_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.NavigationEditPolicy"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.0">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </childNodes>
- <childNodes
- visualID="8000"
- editPartClassName="PseudostateInitialEditPart"
- itemSemanticEditPolicyClassName="PseudostateInitialItemSemanticEditPolicy"
- canonicalEditPolicyClassName="PseudostateInitialCanonicalEditPolicy"
- graphicalNodeEditPolicyClassName="PseudostateInitialNodeGraphicalNodeEditPolicy"
- createCommandClassName="PseudostateInitialCreateCommand"
- containers="/0/@diagram/@compartments.0">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- uniqueIdentifier="org.eclipse.papyrus.diagram.statemachine.Pseudostate_8000"
- displayName="Pseudostate"
- editHelperClassName="PseudostateEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.figures.PseudostateInitialFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="4"
- height="4"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <modelFacet
- modelElementSelector="/0/@expressionProviders/@providers.0/@expressions.11">
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Pseudostate"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Region/subvertex"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.1">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Pseudostate/kind"/>
- </initializers>
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="8001"
- editPartClassName="PseudostateInitialNameEditPart"
- itemSemanticEditPolicyClassName="PseudostateInitialNameItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"
- y="3"/>
- </viewmap>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.0">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="8002"
- editPartClassName="PseudostateInitialStereotypeEditPart"
- itemSemanticEditPolicyClassName="PseudostateInitialStereotypeltemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"
- y="-10"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.1"
- editorPattern="&lt;&lt;0>>"
- editPattern="&lt;&lt;0>>">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </childNodes>
- <childNodes
- visualID="9000"
- editPartClassName="PseudostateJoinEditPart"
- itemSemanticEditPolicyClassName="PseudostateJoinItemSemanticEditPolicy"
- canonicalEditPolicyClassName="PseudostateJoinCanonicalEditPolicy"
- graphicalNodeEditPolicyClassName="PseudostateJoinNodeGraphicalNodeEditPolicy"
- createCommandClassName="PseudostateJoinCreateCommand"
- containers="/0/@diagram/@compartments.0">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- uniqueIdentifier="org.eclipse.papyrus.diagram.statemachine.Pseudostate_9000"
- displayName="Pseudostate"
- editHelperClassName="PseudostateEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.figures.PseudostateJoinForkFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="4"
- height="4"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomPseudostateForkJoinResizeEditPolicy"/>
- <modelFacet
- modelElementSelector="/0/@expressionProviders/@providers.0/@expressions.14">
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Pseudostate"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Region/subvertex"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.4">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Pseudostate/kind"/>
- </initializers>
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="9001"
- editPartClassName="PseudostateJoinNameEditPart"
- itemSemanticEditPolicyClassName="PseudostateJoinNameItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"
- y="3"/>
- </viewmap>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.0">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="9002"
- editPartClassName="PseudostateJoinStereotypeEditPart"
- itemSemanticEditPolicyClassName="PseudostateJoinStereotypeItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"
- y="-10"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.1"
- editorPattern="&lt;&lt;0>>"
- editPattern="&lt;&lt;0>>">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </childNodes>
- <childNodes
- visualID="10000"
- editPartClassName="PseudostateForkEditPart"
- itemSemanticEditPolicyClassName="PseudostateForkItemSemanticEditPolicy"
- canonicalEditPolicyClassName="PseudostateForkCanonicalEditPolicy"
- graphicalNodeEditPolicyClassName="PseudostateForkNodeGraphicalNodeEditPolicy"
- createCommandClassName="PseudostateForkCreateCommand"
- containers="/0/@diagram/@compartments.0">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- uniqueIdentifier="org.eclipse.papyrus.diagram.statemachine.Pseudostate_10000"
- displayName="Pseudostate"
- editHelperClassName="PseudostateEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.figures.PseudostateJoinForkFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="4"
- height="4"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomPseudostateForkJoinResizeEditPolicy"/>
- <modelFacet
- modelElementSelector="/0/@expressionProviders/@providers.0/@expressions.15">
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Pseudostate"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Region/subvertex"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.5">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Pseudostate/kind"/>
- </initializers>
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="10001"
- editPartClassName="PseudostateForkNameEditPart"
- itemSemanticEditPolicyClassName="PseudostateForkNameItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"
- y="3"/>
- </viewmap>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.0">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="10002"
- editPartClassName="PseudostateForkStereotypeEditPart"
- itemSemanticEditPolicyClassName="PseudostateForkStereotypeltemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"
- y="-10"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.1"
- editorPattern="&lt;&lt;0>>"
- editPattern="&lt;&lt;0>>">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </childNodes>
- <childNodes
- visualID="11000"
- editPartClassName="PseudostateChoiceEditPart"
- itemSemanticEditPolicyClassName="PseudostateChoiceItemSemanticEditPolicy"
- canonicalEditPolicyClassName="PseudostateChoiceCanonicalEditPolicy"
- graphicalNodeEditPolicyClassName="PseudostateChoiceNodeGraphicalNodeEditPolicy"
- createCommandClassName="PseudostateChoiceCreateCommand"
- containers="/0/@diagram/@compartments.0">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- uniqueIdentifier="org.eclipse.papyrus.diagram.statemachine.Pseudostate_11000"
- displayName="Pseudostate"
- editHelperClassName="PseudostateEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.figures.PseudostateChoiceFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="4"
- height="4"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <modelFacet
- modelElementSelector="/0/@expressionProviders/@providers.0/@expressions.17">
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Pseudostate"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Region/subvertex"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.7">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Pseudostate/kind"/>
- </initializers>
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="11001"
- editPartClassName="PseudostateChoiceNameEditPart"
- itemSemanticEditPolicyClassName="PseudostateChoiceNameItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"
- y="3"/>
- </viewmap>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.0">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="11002"
- editPartClassName="PseudostateChoiceStereotypeEditPart"
- itemSemanticEditPolicyClassName="PseudostateChoiceStereotypeItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"
- y="-10"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.1"
- editorPattern="&lt;&lt;0>>"
- editPattern="&lt;&lt;0>>">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </childNodes>
- <childNodes
- visualID="12000"
- editPartClassName="PseudostateJunctionEditPart"
- itemSemanticEditPolicyClassName="PseudostateJunctionItemSemanticEditPolicy"
- canonicalEditPolicyClassName="PseudostateJunctionCanonicalEditPolicy"
- graphicalNodeEditPolicyClassName="PseudostateJunctionNodeGraphicalNodeEditPolicy"
- createCommandClassName="PseudostateJunctionCreateCommand"
- containers="/0/@diagram/@compartments.0">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- uniqueIdentifier="org.eclipse.papyrus.diagram.statemachine.Pseudostate_12000"
- displayName="Pseudostate"
- editHelperClassName="PseudostateEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.figures.PseudostateJunctionFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="4"
- height="4"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <modelFacet
- modelElementSelector="/0/@expressionProviders/@providers.0/@expressions.16">
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Pseudostate"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Region/subvertex"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.6">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Pseudostate/kind"/>
- </initializers>
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="12001"
- editPartClassName="PseudostateJunctionNameEditPart"
- itemSemanticEditPolicyClassName="PseudostateJunctionNameItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"
- y="3"/>
- </viewmap>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.0">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="12002"
- editPartClassName="PseudostateJunctionStereotypeEditPart"
- itemSemanticEditPolicyClassName="PseudostateJunctionStereotypeItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"
- y="-10"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.1"
- editorPattern="&lt;&lt;0>>"
- editPattern="&lt;&lt;0>>">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </childNodes>
- <childNodes
- visualID="13000"
- editPartClassName="PseudostateShallowHistoryEditPart"
- itemSemanticEditPolicyClassName="PseudostateShallowHistoryItemSemanticEditPolicy"
- canonicalEditPolicyClassName="PseudostateShallowHistoryCanonicalEditPolicy"
- graphicalNodeEditPolicyClassName="PseudostateShallowHistoryNodeGraphicalNodeEditPolicy"
- createCommandClassName="PseudostateShallowHistoryCreateCommand"
- containers="/0/@diagram/@compartments.0">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- uniqueIdentifier="org.eclipse.papyrus.diagram.statemachine.Pseudostate_13000"
- displayName="Pseudostate"
- editHelperClassName="PseudostateEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.figures.PseudostateShallowHistoryFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="4"
- height="4"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <modelFacet
- modelElementSelector="/0/@expressionProviders/@providers.0/@expressions.13">
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Pseudostate"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Region/subvertex"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.3">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Pseudostate/kind"/>
- </initializers>
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="13001"
- editPartClassName="PseudostateShallowHistoryNameEditPart"
- itemSemanticEditPolicyClassName="PseudostateShallowHistoryNameItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"
- y="3"/>
- </viewmap>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.0">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="13002"
- editPartClassName="PseudostateShallowHistoryStereotypeEditPart"
- itemSemanticEditPolicyClassName="PseudostateShallowHistoryStereotypeItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"
- y="-10"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.1"
- editorPattern="&lt;&lt;0>>"
- editPattern="&lt;&lt;0>>">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </childNodes>
- <childNodes
- visualID="14000"
- editPartClassName="PseudostateDeepHistoryEditPart"
- itemSemanticEditPolicyClassName="PseudostateDeepHistoryItemSemanticEditPolicy"
- canonicalEditPolicyClassName="PseudostateDeepHistoryCanonicalEditPolicy"
- graphicalNodeEditPolicyClassName="PseudostateDeepHistoryNodeGraphicalNodeEditPolicy"
- createCommandClassName="PseudostateDeepHistoryCreateCommand"
- containers="/0/@diagram/@compartments.0">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- uniqueIdentifier="org.eclipse.papyrus.diagram.statemachine.Pseudostate_14000"
- displayName="Pseudostate"
- editHelperClassName="PseudostateEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.figures.PseudostateDeepHistoryFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="4"
- height="4"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <modelFacet
- modelElementSelector="/0/@expressionProviders/@providers.0/@expressions.12">
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Pseudostate"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Region/subvertex"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.2">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Pseudostate/kind"/>
- </initializers>
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="14001"
- editPartClassName="PseudostateDeepHistoryNameEditPart"
- itemSemanticEditPolicyClassName="PseudostateDeepHistoryNameItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"
- y="3"/>
- </viewmap>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.0">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="14002"
- editPartClassName="PseudostateDeepHistoryStereotypeEditPart"
- itemSemanticEditPolicyClassName="PseudostateDeepHistoryStereotypeItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"
- y="-10"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.1"
- editorPattern="&lt;&lt;0>>"
- editPattern="&lt;&lt;0>>">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </childNodes>
- <childNodes
- visualID="15000"
- editPartClassName="PseudostateTerminateEditPart"
- itemSemanticEditPolicyClassName="PseudostateTerminateItemSemanticEditPolicy"
- canonicalEditPolicyClassName="PseudostateTerminateCanonicalEditPolicy"
- graphicalNodeEditPolicyClassName="PseudostateTerminateNodeGraphicalNodeEditPolicy"
- createCommandClassName="PseudostateTerminateCreateCommand"
- containers="/0/@diagram/@compartments.0">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- uniqueIdentifier="org.eclipse.papyrus.diagram.statemachine.Pseudostate_15000"
- displayName="Pseudostate"
- editHelperClassName="PseudostateEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.figures.PseudostateTerminateFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="4"
- height="4"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <modelFacet
- modelElementSelector="/0/@expressionProviders/@providers.0/@expressions.20">
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Pseudostate"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Region/subvertex"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.10">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Pseudostate/kind"/>
- </initializers>
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="15001"
- editPartClassName="PseudostateTerminateNameEditPart"
- itemSemanticEditPolicyClassName="PseudostateTerminateNameItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"
- y="3"/>
- </viewmap>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.0"
- viewPattern="">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="15002"
- editPartClassName="PseudostateTerminateStereotypeEditPart"
- itemSemanticEditPolicyClassName="PseudostateTerminateStereotypeItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"
- y="-10"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.1"
- editorPattern="&lt;&lt;0>>"
- editPattern="&lt;&lt;0>>">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </childNodes>
- <childNodes
- xsi:type="gmfgen:GenChildSideAffixedNode"
- visualID="16000"
- editPartClassName="PseudostateEntryPointEditPart"
- itemSemanticEditPolicyClassName="PseudostateEntryPointItemSemanticEditPolicy"
- canonicalEditPolicyClassName="PseudostateEntryPointCanonicalEditPolicy"
- graphicalNodeEditPolicyClassName="PseudostateEntryPointNodeGraphicalNodeEditPolicy"
- createCommandClassName="PseudostateEntryPointCreateCommand"
- containers="/0/@diagram/@topLevelNodes.0 /0/@diagram/@compartments.0 /0/@diagram/@compartments.1 /0/@diagram/@childNodes.2">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- uniqueIdentifier="org.eclipse.papyrus.diagram.statemachine.Pseudostate_16000"
- displayName="Pseudostate"
- editHelperClassName="PseudostateEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.figures.PseudostateEntryPointFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="4"
- height="4"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <modelFacet
- modelElementSelector="/0/@expressionProviders/@providers.0/@expressions.18">
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Pseudostate"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/StateMachine/connectionPoint"/>
- <childMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/StateMachine/connectionPoint"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.8">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Pseudostate/kind"/>
- </initializers>
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="16001"
- editPartClassName="PseudostateEntryPointNameEditPart"
- itemSemanticEditPolicyClassName="PseudostateEntryPointNameItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"
- y="3"/>
- </viewmap>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.0"
- viewPattern="">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="16002"
- editPartClassName="PseudostateEntryPointStereotypeEditPart"
- itemSemanticEditPolicyClassName="PseudostateEntryPointStereotypeltemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"
- y="-10"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.1"
- editorPattern="&lt;&lt;0>>"
- editPattern="&lt;&lt;0>>">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </childNodes>
- <childNodes
- xsi:type="gmfgen:GenChildSideAffixedNode"
- visualID="17000"
- editPartClassName="PseudostateExitPointEditPart"
- itemSemanticEditPolicyClassName="PseudostateExitPointItemSemanticEditPolicy"
- canonicalEditPolicyClassName="PseudostateExitPointCanonicalEditPolicy"
- graphicalNodeEditPolicyClassName="PseudostateExitPointNodeGraphicalNodeEditPolicy"
- createCommandClassName="PseudostateExitPointCreateCommand"
- containers="/0/@diagram/@compartments.0 /0/@diagram/@compartments.1 /0/@diagram/@topLevelNodes.0 /0/@diagram/@childNodes.2">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- uniqueIdentifier="org.eclipse.papyrus.diagram.statemachine.Pseudostate_17000"
- displayName="Pseudostate"
- editHelperClassName="PseudostateEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.figures.PseudostateExitPointFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="4"
- height="4"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <modelFacet
- modelElementSelector="/0/@expressionProviders/@providers.0/@expressions.19">
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Pseudostate"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/StateMachine/connectionPoint"/>
- <childMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/StateMachine/connectionPoint"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.9">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Pseudostate/kind"/>
- </initializers>
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="17001"
- editPartClassName="PseudostateExitPointNameEditPart"
- itemSemanticEditPolicyClassName="PseudostateExitPointNameItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"
- y="3"/>
- </viewmap>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.0"
- viewPattern="">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="17002"
- editPartClassName="PseudostateExitPointStereotypeEditPart"
- itemSemanticEditPolicyClassName="PseudostateExitPointStereotypeItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"
- y="-10"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.1"
- editorPattern="&lt;&lt;0>>"
- editPattern="&lt;&lt;0>>">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </childNodes>
- <childNodes
- xsi:type="gmfgen:GenChildSideAffixedNode"
- visualID="18000"
- editPartClassName="ConnectionPointReferenceEditPart"
- itemSemanticEditPolicyClassName="ConnectionPointReferenceItemSemanticEditPolicy"
- canonicalEditPolicyClassName="ConnectionPointReferenceCanonicalEditPolicy"
- graphicalNodeEditPolicyClassName="ConnectionPointReferenceNodeGraphicalNodeEditPolicy"
- createCommandClassName="ConnectionPointReferenceCreateCommand"
- containers="/0/@diagram/@childNodes.2 /0/@diagram/@compartments.2">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- uniqueIdentifier="org.eclipse.papyrus.diagram.statemachine.ConnectionPointReference_18000"
- displayName="ConnectionPointReference"
- editHelperClassName="ConnectionPointReferenceEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.figures.ConnectionPointReferenceFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="4"
- height="4"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ConnectionPointReference"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/State/connection"/>
- <childMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/State/connection"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="18001"
- editPartClassName="ConnectionPointReferenceNameEditPart"
- itemSemanticEditPolicyClassName="ConnectionPointReferenceNameItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"
- y="3"/>
- </viewmap>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.0"
- viewPattern="">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="18002"
- editPartClassName="ConnectionPointReferenceStereotypeEditPart"
- itemSemanticEditPolicyClassName="ConnectionPointReferenceItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"
- y="-10"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.1"
- editorPattern="&lt;&lt;0>>"
- editPattern="&lt;&lt;0>>">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </childNodes>
- <topLevelNodes
- visualID="2000"
- editPartClassName="StateMachineEditPart"
- itemSemanticEditPolicyClassName="StateMachineItemSemanticEditPolicy"
- canonicalEditPolicyClassName="StateMachineCanonicalEditPolicy"
- childNodes="/0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12"
- compartments="/0/@diagram/@compartments.1"
- graphicalNodeEditPolicyClassName="StateMachineGraphicalNodeEditPolicy"
- createCommandClassName="StateMachineCreateCommand">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- editHelperClassName="StateMachineEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.figures.StateMachineFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="200"
- height="100"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AffixedNodeAlignmentEditPolicy.AFFIXED_CHILD_ALIGNMENT_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AffixedNodeAlignmentEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateMachineLayoutEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateMachineDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/StateMachine"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/>
- <childMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- <initializers
- xsi:type="gmfgen:GenReferenceNewElementSpec">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/StateMachine/region"/>
- <newElementInitializers>
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </newElementInitializers>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- visualID="2001"
- editPartClassName="StateMachineNameEditPart"
- itemSemanticEditPolicyClassName="StateMachineNameItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getNameLabel"
- figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
- <attributes
- xsi:type="gmfgen:StyleAttributes"
- fixedFont="true"/>
- </viewmap>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.0">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </topLevelNodes>
- <links
- visualID="7000"
- editPartClassName="TransitionEditPart"
- itemSemanticEditPolicyClassName="TransitionItemSemanticEditPolicy"
- createCommandClassName="TransitionCreateCommand"
- reorientCommandClassName="TransitionReorientCommand">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- uniqueIdentifier="org.eclipse.papyrus.diagram.statemachine.Transition_7000"
- displayName="Transition"
- editHelperClassName="TransitionEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.figures.TransitionFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.NavigationEditPolicy.NAVIGATION_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.NavigationEditPolicy"/>
- <modelFacet
- xsi:type="gmfgen:TypeLinkModelFacet">
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Transition"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Region/transition"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- <sourceMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Transition/source"/>
- <targetMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Transition/target"/>
- </modelFacet>
- <labels
- visualID="7001"
- editPartClassName="TransitionNameEditPart"
- itemSemanticEditPolicyClassName="TransitionNameItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.0">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- <labels
- visualID="7002"
- editPartClassName="TransitionGuardEditPart"
- itemSemanticEditPolicyClassName="TransitionGuardItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.2">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Transition/guard"/>
- </modelFacet>
- </labels>
- <labels
- visualID="7003"
- editPartClassName="TransitionStereotypeEditPart"
- itemSemanticEditPolicyClassName="TransitionStereotypeItemSemanticEditPolicy"
- readOnly="true">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getAppliedStereotypeLabel"
- figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- y="60"/>
- </viewmap>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.1"
- viewPattern="&lt;&lt;{0}>>"
- editorPattern="&lt;&lt;{0}>>"
- editPattern="&lt;&lt;{0}>>">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </links>
- <links
- visualID="19000"
- editPartClassName="GeneralizationEditPart"
- itemSemanticEditPolicyClassName="GeneralizationItemSemanticEditPolicy"
- incomingCreationAllowed="true"
- createCommandClassName="GeneralizationCreateCommand"
- reorientCommandClassName="GeneralizationReorientCommand">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- uniqueIdentifier="org.eclipse.papyrus.diagram.statemachine.Generalization_19000"
- displayName="Generalization"
- editHelperClassName="GeneralizationEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.diagram.common.figure.edge.GeneralizationFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy"/>
- <modelFacet
- xsi:type="gmfgen:TypeLinkModelFacet">
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Generalization"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Classifier/generalization"/>
- <childMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Classifier/generalization"/>
- <targetMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Generalization/general"/>
- </modelFacet>
- <labels
- visualID="19002"
- editPartClassName="GeneralizationStereotypeEditPart"
- itemSemanticEditPolicyClassName="GeneralizationStereotypeItemSemanticEditPolicy"
- readOnly="true">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getAppliedStereotypeLabel"
- figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- y="40"/>
- </viewmap>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.0"
- viewPattern="&lt;&lt;{0}>>"
- editorPattern="&lt;&lt;{0}>>"
- editPattern="&lt;&lt;{0}>>">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Generalization/isSubstitutable"/>
- </modelFacet>
- </labels>
- </links>
- <compartments
- visualID="3002"
- editPartClassName="RegionCompartmentEditPart"
- itemSemanticEditPolicyClassName="RegionCompartmentItemSemanticEditPolicy"
- canonicalEditPolicyClassName="RegionCompartmentCanonicalEditPolicy"
- childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.1 /0/@diagram/@childNodes.2 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12"
- title="RegionCompartment"
- canCollapse="false"
- hideIfEmpty="false"
- needsTitle="false"
- node="/0/@diagram/@childNodes.0"
- listLayout="false">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getRegionCompartmentFigure"
- figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;RemoveOrphanView&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.policies.RemoveOrphanViewPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomRegionCompartmentCreationEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateMachineDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomRegionCompartmentXYLayoutEditPolicy"/>
- </compartments>
- <compartments
- visualID="2002"
- editPartClassName="StateMachineCompartmentEditPart"
- itemSemanticEditPolicyClassName="StateMachineCompartmentItemSemanticEditPolicy"
- canonicalEditPolicyClassName="StateMachineCompartmentCanonicalEditPolicy"
- childNodes="/0/@diagram/@childNodes.0 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12"
- title="StateMachineCompartment"
- canCollapse="false"
- hideIfEmpty="false"
- needsTitle="false"
- node="/0/@diagram/@topLevelNodes.0"
- listLayout="false">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getStateMachineCompartmentFigure"
- figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;RemoveOrphanView&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.policies.RemoveOrphanViewPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateMachineCompartmentXYLayoutEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateMachineDiagramDragDropEditPolicy"/>
- </compartments>
- <compartments
- visualID="6002"
- editPartClassName="StateCompartmentEditPart"
- itemSemanticEditPolicyClassName="StateCompartmentItemSemanticEditPolicy"
- canonicalEditPolicyClassName="StateCompartmentCanonicalEditPolicy"
- childNodes="/0/@diagram/@childNodes.0 /0/@diagram/@childNodes.13"
- title="StateCompartment"
- canCollapse="false"
- hideIfEmpty="false"
- needsTitle="false"
- node="/0/@diagram/@childNodes.2"
- listLayout="false">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getStateCompartmentFigure"
- figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;RemoveOrphanView&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.policies.RemoveOrphanViewPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateCompartmentXYLayoutEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateMachineDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateCompartmentCreationEditPolicy"/>
- </compartments>
- <palette>
- <groups
- title="Nodes"
- largeIconPath="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif"
- smallIconPath="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif"
- createMethodName="createNodesGroup"
- stack="true"
- collapse="true">
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="Region"
- description="Region"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Region.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Region.gif"
- createMethodName="createRegionCreationTool"
- genNodes="/0/@diagram/@childNodes.0"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="State"
- description="State"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/State.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/State.gif"
- createMethodName="createStateCreationTool"
- genNodes="/0/@diagram/@childNodes.2"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="Initial"
- description="Initial"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_initial.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_initial.gif"
- createMethodName="createInitialCreationTool"
- genNodes="/0/@diagram/@childNodes.3"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="FinalState"
- description="FinalState"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/FinalState.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/FinalState.gif"
- createMethodName="createFinalStateCreationTool"
- genNodes="/0/@diagram/@childNodes.1"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="ShallowHistory"
- description="ShallowHistory"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_shallowHistory.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_shallowHistory.gif"
- createMethodName="createShallowHistoryCreationTool"
- genNodes="/0/@diagram/@childNodes.8"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="DeepHistory"
- description="DeepHistory"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_deepHistory.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_deepHistory.gif"
- createMethodName="createDeepHistoryCreationTool"
- genNodes="/0/@diagram/@childNodes.9"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="Fork"
- description="Fork"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_fork.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_fork.gif"
- createMethodName="createForkCreationTool"
- genNodes="/0/@diagram/@childNodes.5"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="Join"
- description="Join"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_join.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_join.gif"
- createMethodName="createJoinCreationTool"
- genNodes="/0/@diagram/@childNodes.4"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="Choice"
- description="Choice"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_choice.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_choice.gif"
- createMethodName="createChoiceCreationTool"
- genNodes="/0/@diagram/@childNodes.6"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="Junction"
- description="Junction"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_junction.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_junction.gif"
- createMethodName="createJunctionCreationTool"
- genNodes="/0/@diagram/@childNodes.7"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="EntryPoint"
- description="EntryPoint"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_entryPoint.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_entryPoint.gif"
- createMethodName="createEntryPointCreationTool"
- genNodes="/0/@diagram/@childNodes.11"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="ExitPoint"
- description="ExitPoint"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_exitPoint.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_exitPoint.gif"
- createMethodName="createExitPointCreationTool"
- genNodes="/0/@diagram/@childNodes.12"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="Terminate"
- description="Terminate"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_terminate.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_terminate.gif"
- createMethodName="createTerminateCreationTool"
- genNodes="/0/@diagram/@childNodes.10"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="ConnectionPointReference"
- description="ConnectionPointReference"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ConnectionPointReference.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ConnectionPointReference.gif"
- createMethodName="createConnectionPointReferenceCreationTool"
- genNodes="/0/@diagram/@childNodes.13"/>
- </groups>
- <groups
- title="Edges"
- largeIconPath="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif"
- smallIconPath="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif"
- createMethodName="createEdgesGroup"
- stack="true"
- collapse="true">
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="Transition"
- description="Transition"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Transition_local.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Transition_local.gif"
- createMethodName="createTransitionCreationTool"
- qualifiedToolName=""
- genLinks="/0/@diagram/@links.0"/>
- </groups>
- </palette>
- <preferencePages
- xsi:type="gmfgen:GenStandardPreferencePage"
- iD="org.eclipse.uml2.uml.diagram.general"
- name="UML Diagram">
- <children
- xsi:type="gmfgen:GenStandardPreferencePage"
- iD="org.eclipse.uml2.uml.diagram.appearance"
- name="Appearance"
- kind="Appearance"/>
- <children
- xsi:type="gmfgen:GenStandardPreferencePage"
- iD="org.eclipse.uml2.uml.diagram.connections"
- name="Connections"
- kind="Connections"/>
- <children
- xsi:type="gmfgen:GenStandardPreferencePage"
- iD="org.eclipse.uml2.uml.diagram.printing"
- name="Printing"
- kind="Printing"/>
- <children
- xsi:type="gmfgen:GenStandardPreferencePage"
- iD="org.eclipse.uml2.uml.diagram.rulersAndGrid"
- name="Rulers And Grid"
- kind="RulersAndGrid"/>
- <children
- xsi:type="gmfgen:GenStandardPreferencePage"
- iD="org.eclipse.uml2.uml.diagram.pathmaps"
- name="Pathmaps"
- kind="Pathmaps"/>
- </preferencePages>
- </diagram>
- <plugin
- iD="org.eclipse.papyrus.diagram.statemachine"
- name="PapyrusUMLStateMachineDiagram"/>
- <editor
- iconPath="icons/UMLDiagramFile.gif"/>
- <navigator>
- <childReferences
- child="/0/@diagram"/>
- <childReferences
- parent="/0/@diagram/@topLevelNodes.0"
- child="/0/@diagram/@childNodes.0"/>
- <childReferences
- parent="/0/@diagram"
- child="/0/@diagram/@topLevelNodes.0"/>
- </navigator>
- <diagramUpdater/>
- <propertySheet>
- <tabs
- xsi:type="gmfgen:GenStandardPropertyTab"
- iD="appearance"/>
- <tabs
- xsi:type="gmfgen:GenStandardPropertyTab"
- iD="diagram"
- label="Rulers &amp; Grid"/>
- <tabs
- xsi:type="gmfgen:GenCustomPropertyTab"
- iD="domain"
- label="Core">
- <filter
- xsi:type="gmfgen:TypeTabFilter">
- <types>org.eclipse.gmf.runtime.notation.View</types>
- <types>org.eclipse.gef.EditPart</types>
- <generatedTypes>abstractNavigatorItem</generatedTypes>
- </filter>
- </tabs>
- <tabs
- xsi:type="gmfgen:GenCustomPropertyTab"
- iD="domain"
- label="Core">
- <filter
- xsi:type="gmfgen:TypeTabFilter">
- <types>org.eclipse.gmf.runtime.notation.View</types>
- <types>org.eclipse.gef.EditPart</types>
- <generatedTypes>abstractNavigatorItem</generatedTypes>
- </filter>
- </tabs>
- <tabs
- xsi:type="gmfgen:GenCustomPropertyTab"
- iD="domain"
- label="Core">
- <filter
- xsi:type="gmfgen:TypeTabFilter">
- <types>org.eclipse.gmf.runtime.notation.View</types>
- <types>org.eclipse.gef.EditPart</types>
- <generatedTypes>abstractNavigatorItem</generatedTypes>
- </filter>
- </tabs>
- </propertySheet>
- <domainGenModel
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#/"/>
- <expressionProviders
- expressionsPackageName="org.eclipse.papyrus.diagram.statemachine.custom.expressions">
- <providers
- xsi:type="gmfgen:GenJavaExpressionProvider"
- injectExpressionBody="true">
- <expressions
- body="//provides a new name taking into account the pseudostatekind if any&#xA;&#x9;&#x9;String baseString = self.eClass().getName();&#xA;&#x9;&#x9;if(self instanceof org.eclipse.uml2.uml.Pseudostate){&#x9;&#xA;&#x9;&#x9;&#x9;baseString = ((org.eclipse.uml2.uml.Pseudostate)self).getKind().getLiteral();&#xA;&#x9;&#x9;&#x9;baseString = baseString.substring(0, 1).toUpperCase() + baseString.substring(1);&#xA;&#x9;&#x9;}&#xA;&#x9;&#x9;String name = &quot;&quot;; //$NON-NLS-1$&#xA;&#xA;&#x9;&#x9;org.eclipse.uml2.uml.Element umlParent = self.getOwner();&#xA;&#xA;&#x9;&#x9;boolean found = false;&#xA;&#x9;&#x9;// i &lt;10000: avoid infinite loops&#xA;&#x9;&#x9;for(int i = 0; i &lt; 10001; i++) {&#xA;&#x9;&#x9;&#x9;found = false;&#xA;&#x9;&#x9;&#x9;name = baseString + i;&#xA;&#x9;&#x9;&#x9;java.util.Iterator it = umlParent.getOwnedElements().iterator();&#xA;&#x9;&#x9;&#x9;while(it.hasNext() &amp;&amp; !found) {&#xA;&#x9;&#x9;&#x9;&#x9;Object o = it.next();&#xA;&#x9;&#x9;&#x9;&#x9;if(o instanceof org.eclipse.uml2.uml.NamedElement) {&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;if(name.equals(((org.eclipse.uml2.uml.NamedElement)o).getName())) {&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;found = true;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;}&#xA;&#x9;&#x9;&#x9;&#x9;}&#xA;&#x9;&#x9;&#x9;}&#xA;&#x9;&#x9;&#x9;if(!found) {&#xA;&#x9;&#x9;&#x9;&#x9;return name;&#xA;&#x9;&#x9;&#x9;}&#xA;&#x9;&#x9;}&#xA;&#x9;&#x9;return baseString + &quot;X&quot;; //$NON-NLS-1$&#xA;"/>
- <expressions
- body="return org.eclipse.uml2.uml.PseudostateKind.INITIAL_LITERAL;"/>
- <expressions
- body="return org.eclipse.uml2.uml.PseudostateKind.DEEP_HISTORY_LITERAL;"/>
- <expressions
- body="return org.eclipse.uml2.uml.PseudostateKind.SHALLOW_HISTORY_LITERAL;"/>
- <expressions
- body="return org.eclipse.uml2.uml.PseudostateKind.JOIN_LITERAL;"/>
- <expressions
- body="return org.eclipse.uml2.uml.PseudostateKind.FORK_LITERAL;"/>
- <expressions
- body="return org.eclipse.uml2.uml.PseudostateKind.JUNCTION_LITERAL;"/>
- <expressions
- body="return org.eclipse.uml2.uml.PseudostateKind.CHOICE_LITERAL;"/>
- <expressions
- body="return org.eclipse.uml2.uml.PseudostateKind.ENTRY_POINT_LITERAL;"/>
- <expressions
- body="return org.eclipse.uml2.uml.PseudostateKind.EXIT_POINT_LITERAL;"/>
- <expressions
- body="return org.eclipse.uml2.uml.PseudostateKind.TERMINATE_LITERAL;"/>
- <expressions
- xsi:type="gmfgen:GenConstraint"
- body="// Test if the pseudostate is an initial&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = ((org.eclipse.uml2.uml.Pseudostate) domainElement).getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.INITIAL_LITERAL))&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
- <expressions
- xsi:type="gmfgen:GenConstraint"
- body="// Test if the pseudostate is a deepHistory&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = ((org.eclipse.uml2.uml.Pseudostate) domainElement).getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.DEEP_HISTORY_LITERAL))&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
- <expressions
- xsi:type="gmfgen:GenConstraint"
- body="// Test if the pseudostate is a shallowHistory&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = ((org.eclipse.uml2.uml.Pseudostate) domainElement).getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.SHALLOW_HISTORY_LITERAL))&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
- <expressions
- xsi:type="gmfgen:GenConstraint"
- body="// Test if the pseudostate is a join&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = ((org.eclipse.uml2.uml.Pseudostate) domainElement).getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.JOIN_LITERAL))&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
- <expressions
- xsi:type="gmfgen:GenConstraint"
- body="// Test if the pseudostate is a fork&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = ((org.eclipse.uml2.uml.Pseudostate) domainElement).getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.FORK_LITERAL))&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
- <expressions
- xsi:type="gmfgen:GenConstraint"
- body="// Test if the pseudostate is a junction&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = ((org.eclipse.uml2.uml.Pseudostate) domainElement).getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.JUNCTION_LITERAL))&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
- <expressions
- xsi:type="gmfgen:GenConstraint"
- body="// Test if the pseudostate is a choice&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = ((org.eclipse.uml2.uml.Pseudostate) domainElement).getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.CHOICE_LITERAL))&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
- <expressions
- xsi:type="gmfgen:GenConstraint"
- body="// Test if the pseudostate is an entryPoint&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = ((org.eclipse.uml2.uml.Pseudostate) domainElement).getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.ENTRY_POINT_LITERAL))&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
- <expressions
- xsi:type="gmfgen:GenConstraint"
- body="// Test if the pseudostate is an exitPoint&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = ((org.eclipse.uml2.uml.Pseudostate) domainElement).getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.EXIT_POINT_LITERAL))&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
- <expressions
- xsi:type="gmfgen:GenConstraint"
- body="// Test if the pseudostate is a terminate&#xD;&#xA;&#x9;&#x9;if (domainElement instanceof org.eclipse.uml2.uml.Pseudostate) {&#xD;&#xA;&#x9;&#x9;&#x9;org.eclipse.uml2.uml.PseudostateKind kind = ((org.eclipse.uml2.uml.Pseudostate) domainElement).getKind();&#xA;&#x9;&#x9;&#x9;if(kind.equals(org.eclipse.uml2.uml.PseudostateKind.TERMINATE_LITERAL))&#xA;&#x9;&#x9;&#x9;&#x9;return true;&#xA;&#x9;&#x9;}&#xD;&#xA;&#x9;&#x9;return false;"/>
- </providers>
- </expressionProviders>
- <labelParsers
- extensibleViaService="true">
- <implementations
- xsi:type="gmfgen:PredefinedParser"
- uses="/0/@diagram/@topLevelNodes.0/@labels.0/@modelFacet /0/@diagram/@childNodes.2/@labels.0/@modelFacet /0/@diagram/@childNodes.1/@labels.0/@modelFacet /0/@diagram/@links.0/@labels.0/@modelFacet /0/@diagram/@childNodes.3/@labels.0/@modelFacet /0/@diagram/@childNodes.4/@labels.0/@modelFacet /0/@diagram/@childNodes.5/@labels.0/@modelFacet /0/@diagram/@childNodes.6/@labels.0/@modelFacet /0/@diagram/@childNodes.7/@labels.0/@modelFacet /0/@diagram/@childNodes.8/@labels.0/@modelFacet /0/@diagram/@childNodes.9/@labels.0/@modelFacet /0/@diagram/@childNodes.10/@labels.0/@modelFacet /0/@diagram/@childNodes.11/@labels.0/@modelFacet /0/@diagram/@childNodes.12/@labels.0/@modelFacet /0/@diagram/@childNodes.13/@labels.0/@modelFacet /0/@diagram/@links.1/@labels.0/@modelFacet"/>
- <implementations
- xsi:type="gmfgen:CustomParser"
- uses="/0/@diagram/@links.0/@labels.2/@modelFacet /0/@diagram/@childNodes.1/@labels.1/@modelFacet /0/@diagram/@childNodes.3/@labels.1/@modelFacet /0/@diagram/@childNodes.4/@labels.1/@modelFacet /0/@diagram/@childNodes.5/@labels.1/@modelFacet /0/@diagram/@childNodes.6/@labels.1/@modelFacet /0/@diagram/@childNodes.7/@labels.1/@modelFacet /0/@diagram/@childNodes.8/@labels.1/@modelFacet /0/@diagram/@childNodes.9/@labels.1/@modelFacet /0/@diagram/@childNodes.10/@labels.1/@modelFacet /0/@diagram/@childNodes.11/@labels.1/@modelFacet /0/@diagram/@childNodes.12/@labels.1/@modelFacet /0/@diagram/@childNodes.13/@labels.1/@modelFacet"
- qualifiedName="org.eclipse.papyrus.diagram.common.parser.stereotype.AppliedStereotypeParser"/>
- <implementations
- xsi:type="gmfgen:CustomParser"
- uses="/0/@diagram/@links.0/@labels.1/@modelFacet"
- qualifiedName="org.eclipse.papyrus.diagram.statemachine.custom.parsers.TransitionPropertiesParser"/>
- </labelParsers>
- <contextMenus
- context="/0/@diagram">
- <items
- xsi:type="gmfgen:LoadResourceAction"/>
- </contextMenus>
- </gmfgen:GenEditorGenerator>
- <papyrusgmfgenextension:PapyrusExtensionRootNode
- comment="Papyrus specific extension for GMFGen">
- <extensionNodes
- xsi:type="papyrusgmfgenextension:ExtendedGenView"
- comment="Add super class to a selected set of generated EditParts"
- genView="/0/@diagram/@topLevelNodes.0 /0/@diagram/@childNodes.2 /0/@diagram/@childNodes.0"
- name="NamedElementEditPart"
- superOwnedEditPart="org.eclipse.papyrus.diagram.common.editparts.NamedElementEditPart"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:ExtendedGenView"
- comment="Label in charge to display applied stereotypes on links"
- genView="/0/@diagram/@links.0 /0/@diagram/@links.1"
- name="UMLConnectionNodeEditPart"
- superOwnedEditPart="org.eclipse.papyrus.diagram.common.editparts.UMLConnectionNodeEditPart"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:SpecificLocatorExternalLabel"
- comment="ExternalLabel locator"
- classpath="org.eclipse.papyrus.diagram.common.locator.ExternalLabelPositionLocator"
- genExternalNodeLabel="/0/@diagram/@childNodes.1/@labels.1 /0/@diagram/@childNodes.3/@labels.1 /0/@diagram/@childNodes.4/@labels.1 /0/@diagram/@childNodes.5/@labels.1 /0/@diagram/@childNodes.6/@labels.1 /0/@diagram/@childNodes.7/@labels.1 /0/@diagram/@childNodes.8/@labels.1 /0/@diagram/@childNodes.9/@labels.1 /0/@diagram/@childNodes.10/@labels.1 /0/@diagram/@childNodes.11/@labels.1 /0/@diagram/@childNodes.1/@labels.0 /0/@diagram/@childNodes.3/@labels.0 /0/@diagram/@childNodes.4/@labels.0 /0/@diagram/@childNodes.5/@labels.0 /0/@diagram/@childNodes.6/@labels.0 /0/@diagram/@childNodes.7/@labels.0 /0/@diagram/@childNodes.8/@labels.0 /0/@diagram/@childNodes.9/@labels.0 /0/@diagram/@childNodes.10/@labels.0 /0/@diagram/@childNodes.11/@labels.0 /0/@diagram/@childNodes.12/@labels.0 /0/@diagram/@childNodes.13/@labels.0"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:ExtendedGenView"
- comment="Manages stereotype shown with External Label"
- genView="/0/@diagram/@childNodes.1/@labels.1 /0/@diagram/@childNodes.3/@labels.1 /0/@diagram/@childNodes.4/@labels.1 /0/@diagram/@childNodes.5/@labels.1 /0/@diagram/@childNodes.6/@labels.1 /0/@diagram/@childNodes.7/@labels.1 /0/@diagram/@childNodes.8/@labels.1 /0/@diagram/@childNodes.9/@labels.1 /0/@diagram/@childNodes.10/@labels.1 /0/@diagram/@childNodes.11/@labels.1 /0/@diagram/@childNodes.12/@labels.1 /0/@diagram/@childNodes.13/@labels.1"
- name="StereotypeLabel"
- superOwnedEditPart="org.eclipse.papyrus.diagram.common.editparts.AbstractLabelEditPart"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:SpecificLocator"
- comment="Affixed EntryExitPoints ConnectionPointReferences Locator"
- classpath="org.eclipse.papyrus.diagram.statemachine.custom.locators.CustomEntryExitPointPositionLocator"
- genChildSideAffixedNode="/0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.13"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:SpecificDiagramUpdater"
- comment="Region compartment custom DiagramUpdater"
- classpath="org.eclipse.papyrus.diagram.statemachine.custom.parts.RegionCompartmentDiagramUpdater"
- genNode="/0/@diagram/@compartments.0"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:ExtendedGenView"
- comment="Manage named element figure relying on Affixed Node"
- genView="/0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.13"
- name="AffixedNode"
- superOwnedEditPart="org.eclipse.papyrus.diagram.common.editparts.AbstractBorderEditPart"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:ExtendedGenView"
- comment="elements that intherit form UMLNodeEditpart"
- genView="/0/@diagram/@childNodes.1 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.10"
- name="UMLNodeEditPart"
- superOwnedEditPart="org.eclipse.papyrus.diagram.common.editparts.UMLNodeEditPart"/>
- </papyrusgmfgenextension:PapyrusExtensionRootNode>
-</xmi:XMI>
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/plugin.properties b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/plugin.properties
deleted file mode 100644
index 9c8f06bd4a6..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/plugin.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-pluginName=Papyrus State Machine Diagram (Incubation)
-providerName=Eclipse Modeling Project
-context.description=PapyrusUMLStateMachineDiagram Diagram Editing
-context.name=In PapyrusUMLStateMachineDiagram Diagram Editor
-navigatorContentName=*.PapyrusUMLStateMachine_diagram diagram contents
-domainNavigatorContentName=*.PapyrusUMLStateMachine model contents
-update.diagram.name=Update PapyrusUMLStateMachineDiagram diagram
-update.diagram.description=Perform PapyrusUMLStateMachineDiagram diagram update
-tab.appearance=Appearance
-tab.diagram=Rulers & Grid
-tab.domain=Core
-prefpage.org.eclipse.uml2.uml.diagram.printing=Printing
-prefpage.org.eclipse.uml2.uml.diagram.rulersAndGrid=Rulers And Grid
-metatype.name.Package_1000=Undefined
-metatype.name.StateMachine_2000=StateMachine
-metatype.name.Region_3000=Region
-metatype.name.Pseudostate_4000=Pseudostate
-metatype.name.FinalState_5000=FinalState
-metatype.name.State_6000=State
-metatype.name.Transition_7000=Transition
-cmdcategory.name=PapyrusUMLStateMachineDiagram Editor Commands
-cmdcategory.desc=PapyrusUMLStateMachineDiagram Editor Commands
-editorName=PapyrusUMLStateMachineDiagram Diagram Editing
-newWizardName=PapyrusUMLStateMachineDiagram Diagram
-newWizardDesc=Creates PapyrusUMLStateMachineDiagram diagram.
-initDiagramActionLabel=Initialize PapyrusUMLStateMachine_diagram diagram file
-prefpage.org.eclipse.uml2.uml.diagram.general=UML Diagram
-prefpage.org.eclipse.uml2.uml.diagram.appearance=Appearance
-prefpage.org.eclipse.uml2.uml.diagram.connections=Connections
-prefpage.org.eclipse.uml2.uml.diagram.pathmaps=Pathmaps
-metatype.name.Pseudostate_7000=Pseudostate
-metatype.name.Pseudostate_8000=Pseudostate
-metatype.name.Pseudostate_9000=Pseudostate
-metatype.name.Pseudostate_10000=Pseudostate
-metatype.name.Pseudostate_11000=Pseudostate
-metatype.name.Pseudostate_12000=Pseudostate
-metatype.name.Pseudostate_13000=Pseudostate
-metatype.name.Pseudostate_14000=Pseudostate
-metatype.name.Pseudostate_15000=Pseudostate
-metatype.name.Pseudostate_16000=Pseudostate
-metatype.name.Pseudostate_17000=Pseudostate
-metatype.name.ConnectionPointReference_18000=ConnectionPointReference
-metatype.name.Generalization_19000=Generalization
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/plugin.xml b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/plugin.xml
deleted file mode 100644
index 38859291904..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/plugin.xml
+++ /dev/null
@@ -1,1080 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
-
-
- <extension point="org.eclipse.gmf.runtime.common.ui.services.markerNavigationProviders" id="markers-navigation">
- <?gmfgen generated="true"?>
- <MarkerNavigationProvider class="org.eclipse.papyrus.diagram.statemachine.providers.UMLMarkerNavigationProvider">
- <MarkerType name="org.eclipse.papyrus.diagram.statemachine.diagnostic"/>
- <Priority name="Lowest"/>
- </MarkerNavigationProvider>
- </extension>
-
- <extension id="diagnostic" name="PapyrusUMLStateMachineDiagram problems" point="org.eclipse.core.resources.markers">
- <?gmfgen generated="true"?>
- <super type="org.eclipse.core.resources.problemmarker"/>
- <super type="org.eclipse.gmf.runtime.common.ui.services.marker"/>
- <persistent value="true"/>
- </extension>
-
- <extension point="org.eclipse.core.runtime.preferences">
- <?gmfgen generated="true"?>
- <initializer class="org.eclipse.papyrus.diagram.statemachine.preferences.DiagramPreferenceInitializer"/>
- </extension>
-
- <extension point="org.eclipse.ui.preferencePages" id="prefpages">
- <?gmfgen generated="true"?>
- <page
- id="org.eclipse.papyrus.preferences.diagrams.PapyrusUMLStateMachineDiagram"
- name="PapyrusUMLStateMachineDiagram Diagram"
- category="org.eclipse.papyrus.preferences.diagrams"
- class="org.eclipse.papyrus.diagram.statemachine.preferences.DiagramGeneralPreferencePage">
- </page>
-
-
-
- <page
- id="org.eclipse.papyrus.diagram.statemachine.preferences.DiagramPrintingPreferencePage"
- name="%prefpage.org.eclipse.uml2.uml.diagram.printing"
- category="org.eclipse.papyrus.preferences.diagrams.PapyrusUMLStateMachineDiagram"
- class="org.eclipse.papyrus.diagram.statemachine.preferences.DiagramPrintingPreferencePage">
- </page>
-
- <page
- id="org.eclipse.papyrus.diagram.statemachine.preferences.DiagramRulersAndGridPreferencePage"
- name="%prefpage.org.eclipse.uml2.uml.diagram.rulersAndGrid"
- category="org.eclipse.papyrus.preferences.diagrams.PapyrusUMLStateMachineDiagram"
- class="org.eclipse.papyrus.diagram.statemachine.preferences.DiagramRulersAndGridPreferencePage">
- </page>
-
-
- </extension>
-
- <extension point="org.eclipse.ui.views.properties.tabbed.propertyContributor" id="prop-contrib">
- <?gmfgen generated="true"?>
- <propertyContributor
- contributorId="org.eclipse.papyrus.diagram.statemachine"
- labelProvider="org.eclipse.papyrus.diagram.statemachine.sheet.UMLSheetLabelProvider">
- <propertyCategory category="domain"/>
- <propertyCategory category="visual"/>
- <propertyCategory category="extra"/>
- </propertyContributor>
- </extension>
-
- <extension point="org.eclipse.ui.views.properties.tabbed.propertyTabs" id="proptabs">
- <?gmfgen generated="true"?>
- <propertyTabs contributorId="org.eclipse.papyrus.diagram.statemachine">
- <propertyTab
- category="visual"
- id="property.tab.AppearancePropertySection"
- label="%tab.appearance"/>
- <propertyTab
- category="visual"
- id="property.tab.DiagramPropertySection"
- label="%tab.diagram"/>
- <propertyTab
- category="domain"
- id="property.tab.domain"
- label="%tab.domain"/>
- <propertyTab
- category="domain"
- id="property.tab.domain"
- label="%tab.domain"/>
- <propertyTab
- category="domain"
- id="property.tab.domain"
- label="%tab.domain"/>
- </propertyTabs>
- </extension>
-
- <extension point="org.eclipse.ui.views.properties.tabbed.propertySections" id="propsections">
- <?gmfgen generated="true"?>
- <propertySections contributorId="org.eclipse.papyrus.diagram.statemachine">
- <propertySection id="property.section.ConnectorAppearancePropertySection"
- filter="org.eclipse.gmf.runtime.diagram.ui.properties.filters.ConnectionEditPartPropertySectionFilter"
- class="org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ConnectionAppearancePropertySection"
- tab="property.tab.AppearancePropertySection">
- </propertySection>
- <propertySection id="property.section.ShapeColorAndFontPropertySection"
- filter="org.eclipse.gmf.runtime.diagram.ui.properties.filters.ShapeEditPartPropertySectionFilter"
- class="org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ShapeColorsAndFontsPropertySection"
- tab="property.tab.AppearancePropertySection">
- </propertySection>
- <propertySection id="property.section.DiagramColorsAndFontsPropertySection"
- filter="org.eclipse.gmf.runtime.diagram.ui.properties.filters.DiagramEditPartPropertySectionFilter"
- class="org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.DiagramColorsAndFontsPropertySection"
- tab="property.tab.AppearancePropertySection">
- </propertySection>
- <propertySection id="property.section.RulerGridPropertySection"
- filter="org.eclipse.gmf.runtime.diagram.ui.properties.filters.DiagramEditPartPropertySectionFilter"
- class="org.eclipse.gmf.runtime.diagram.ui.properties.sections.grid.RulerGridPropertySection"
- tab="property.tab.DiagramPropertySection">
- </propertySection>
- <propertySection
- id="property.section.domain"
- tab="property.tab.domain"
- class="org.eclipse.papyrus.diagram.statemachine.sheet.UMLPropertySection">
- <input type="org.eclipse.gmf.runtime.notation.View"/>
- <input type="org.eclipse.gef.EditPart"/>
- <input type="org.eclipse.papyrus.diagram.statemachine.navigator.UMLAbstractNavigatorItem"/>
- </propertySection>
- <propertySection
- id="property.section.domain"
- tab="property.tab.domain"
- class="org.eclipse.papyrus.diagram.statemachine.sheet.UMLPropertySection">
- <input type="org.eclipse.gmf.runtime.notation.View"/>
- <input type="org.eclipse.gef.EditPart"/>
- <input type="org.eclipse.papyrus.diagram.statemachine.navigator.UMLAbstractNavigatorItem"/>
- </propertySection>
- <propertySection
- id="property.section.domain"
- tab="property.tab.domain"
- class="org.eclipse.papyrus.diagram.statemachine.sheet.UMLPropertySection">
- <input type="org.eclipse.gmf.runtime.notation.View"/>
- <input type="org.eclipse.gef.EditPart"/>
- <input type="org.eclipse.papyrus.diagram.statemachine.navigator.UMLAbstractNavigatorItem"/>
- </propertySection>
- </propertySections>
- </extension>
-
-
-<?gmfgen generated="true"?>
-
-
- <extension point="org.eclipse.gmf.runtime.diagram.core.viewProviders" id="view-provider">
- <?gmfgen generated="true"?>
- <viewProvider class="org.eclipse.papyrus.diagram.statemachine.providers.UMLViewProvider">
- <Priority name="Lowest"/>
- <context viewClass="org.eclipse.gmf.runtime.notation.Diagram" semanticHints="PapyrusUMLStateMachineDiagram"/>
- <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="2000,3000,5000,6000,8000,9000,10000,11000,12000,13000,14000,15000,16000,17000,18000"/>
- <context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="7000,19000"/>
- </viewProvider>
- </extension>
-
- <extension point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders" id="ep-provider">
- <?gmfgen generated="true"?>
- <editpartProvider class="org.eclipse.papyrus.diagram.statemachine.providers.UMLEditPartProvider">
- <Priority name="Lowest"/>
- <object class="org.eclipse.gmf.runtime.notation.Diagram" id="generated-diagram">
- <method name="getType()" value="PapyrusUMLStateMachineDiagram"/>
- </object>
- <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-nodes">
- <method name="getType()" value="2000,3000,5000,6000,8000,9000,10000,11000,12000,13000,14000,15000,16000,17000,18000"/>
- </object>
- <object class="org.eclipse.gmf.runtime.notation.Edge" id="generated-links">
- <method name="getType()" value="7000,19000"/>
- </object>
- <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-labels">
- <method name="getType()" value="2001,5001,5002,6001,8001,8002,9001,9002,10001,10002,11001,11002,12001,12002,13001,13002,14001,14002,15001,15002,16001,16002,17001,17002,18001,18002"/>
- </object>
- <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-compartments">
- <method name="getType()" value="3002,2002,6002"/>
- </object>
- <context views="generated-diagram,generated-nodes,generated-links,generated-labels,generated-compartments"/>
- </editpartProvider>
- </extension>
-
- <extension point="org.eclipse.gmf.runtime.emf.ui.modelingAssistantProviders" id="modelassist-provider">
- <?gmfgen generated="true"?>
- <modelingAssistantProvider class="org.eclipse.papyrus.diagram.statemachine.providers.UMLModelingAssistantProvider">
- <Priority name="Lowest"/>
- <object class="org.eclipse.papyrus.diagram.statemachine.edit.parts.PackageEditPart" id="Package_1000"/>
- <object class="org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineEditPart" id="StateMachine_2000"/>
- <context elements="Package_1000,StateMachine_2000"/>
- </modelingAssistantProvider>
- </extension>
-
- <extension point="org.eclipse.gmf.runtime.common.ui.services.iconProviders" id="icon-provider">
- <?gmfgen generated="true"?>
- <IconProvider class="org.eclipse.papyrus.diagram.statemachine.providers.UMLIconProvider">
- <Priority name="Low"/>
- </IconProvider>
- </extension>
-
- <extension point="org.eclipse.gmf.runtime.common.ui.services.parserProviders" id="parser-provider">
- <?gmfgen generated="true"?>
- <ParserProvider class="org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider">
- <Priority name="Lowest"/>
- </ParserProvider>
- </extension>
-
- <extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypes" id="element-types">
- <?gmfgen generated="true"?>
- <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.diagram.statemachine.Package_1000"
- name="%metatype.name.Package_1000"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Package"
- edithelper="org.eclipse.papyrus.diagram.statemachine.edit.helpers.PackageEditHelper">
- <param name="semanticHint" value="1000"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.diagram.statemachine.StateMachine_2000"
- name="%metatype.name.StateMachine_2000"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="StateMachine"
- edithelper="org.eclipse.papyrus.diagram.statemachine.edit.helpers.StateMachineEditHelper">
- <param name="semanticHint" value="2000"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.diagram.statemachine.Region_3000"
- name="%metatype.name.Region_3000"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Region"
- edithelper="org.eclipse.papyrus.diagram.statemachine.edit.helpers.RegionEditHelper">
- <param name="semanticHint" value="3000"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.diagram.statemachine.FinalState_5000"
- name="%metatype.name.FinalState_5000"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="FinalState"
- edithelper="org.eclipse.papyrus.diagram.statemachine.edit.helpers.FinalStateEditHelper">
- <param name="semanticHint" value="5000"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.diagram.statemachine.State_6000"
- name="%metatype.name.State_6000"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="State"
- edithelper="org.eclipse.papyrus.diagram.statemachine.edit.helpers.StateEditHelper">
- <param name="semanticHint" value="6000"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.diagram.statemachine.Pseudostate_8000"
- name="%metatype.name.Pseudostate_8000"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Pseudostate"
- edithelper="org.eclipse.papyrus.diagram.statemachine.edit.helpers.PseudostateEditHelper">
- <param name="semanticHint" value="8000"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.diagram.statemachine.Pseudostate_9000"
- name="%metatype.name.Pseudostate_9000"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Pseudostate"
- edithelper="org.eclipse.papyrus.diagram.statemachine.edit.helpers.PseudostateEditHelper">
- <param name="semanticHint" value="9000"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.diagram.statemachine.Pseudostate_10000"
- name="%metatype.name.Pseudostate_10000"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Pseudostate"
- edithelper="org.eclipse.papyrus.diagram.statemachine.edit.helpers.PseudostateEditHelper">
- <param name="semanticHint" value="10000"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.diagram.statemachine.Pseudostate_11000"
- name="%metatype.name.Pseudostate_11000"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Pseudostate"
- edithelper="org.eclipse.papyrus.diagram.statemachine.edit.helpers.PseudostateEditHelper">
- <param name="semanticHint" value="11000"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.diagram.statemachine.Pseudostate_12000"
- name="%metatype.name.Pseudostate_12000"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Pseudostate"
- edithelper="org.eclipse.papyrus.diagram.statemachine.edit.helpers.PseudostateEditHelper">
- <param name="semanticHint" value="12000"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.diagram.statemachine.Pseudostate_13000"
- name="%metatype.name.Pseudostate_13000"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Pseudostate"
- edithelper="org.eclipse.papyrus.diagram.statemachine.edit.helpers.PseudostateEditHelper">
- <param name="semanticHint" value="13000"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.diagram.statemachine.Pseudostate_14000"
- name="%metatype.name.Pseudostate_14000"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Pseudostate"
- edithelper="org.eclipse.papyrus.diagram.statemachine.edit.helpers.PseudostateEditHelper">
- <param name="semanticHint" value="14000"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.diagram.statemachine.Pseudostate_15000"
- name="%metatype.name.Pseudostate_15000"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Pseudostate"
- edithelper="org.eclipse.papyrus.diagram.statemachine.edit.helpers.PseudostateEditHelper">
- <param name="semanticHint" value="15000"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.diagram.statemachine.Pseudostate_16000"
- name="%metatype.name.Pseudostate_16000"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Pseudostate"
- edithelper="org.eclipse.papyrus.diagram.statemachine.edit.helpers.PseudostateEditHelper">
- <param name="semanticHint" value="16000"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.diagram.statemachine.Pseudostate_17000"
- name="%metatype.name.Pseudostate_17000"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Pseudostate"
- edithelper="org.eclipse.papyrus.diagram.statemachine.edit.helpers.PseudostateEditHelper">
- <param name="semanticHint" value="17000"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.diagram.statemachine.ConnectionPointReference_18000"
- name="%metatype.name.ConnectionPointReference_18000"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="ConnectionPointReference"
- edithelper="org.eclipse.papyrus.diagram.statemachine.edit.helpers.ConnectionPointReferenceEditHelper">
- <param name="semanticHint" value="18000"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.diagram.statemachine.Transition_7000"
- name="%metatype.name.Transition_7000"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Transition"
- edithelper="org.eclipse.papyrus.diagram.statemachine.edit.helpers.TransitionEditHelper">
- <param name="semanticHint" value="7000"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.diagram.statemachine.Generalization_19000"
- name="%metatype.name.Generalization_19000"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Generalization"
- edithelper="org.eclipse.papyrus.diagram.statemachine.edit.helpers.GeneralizationEditHelper">
- <param name="semanticHint" value="19000"/>
- </metamodelType>
- </metamodel>
- </extension>
-
- <extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings" id="element-types-bindings">
- <?gmfgen generated="true"?>
- <clientContext id="org.eclipse.papyrus.diagram.statemachine.TypeContext">
- <enablement>
- <test
- property="org.eclipse.gmf.runtime.emf.core.editingDomain"
- value="org.eclipse.papyrus.diagram.statemachine.EditingDomain"/>
- </enablement>
- </clientContext>
- <binding context="org.eclipse.papyrus.diagram.statemachine.TypeContext">
- <elementType ref="org.eclipse.papyrus.diagram.statemachine.Package_1000"/>
- <elementType ref="org.eclipse.papyrus.diagram.statemachine.StateMachine_2000"/>
- <elementType ref="org.eclipse.papyrus.diagram.statemachine.Region_3000"/>
- <elementType ref="org.eclipse.papyrus.diagram.statemachine.FinalState_5000"/>
- <elementType ref="org.eclipse.papyrus.diagram.statemachine.State_6000"/>
- <elementType ref="org.eclipse.papyrus.diagram.statemachine.Pseudostate_8000"/>
- <elementType ref="org.eclipse.papyrus.diagram.statemachine.Pseudostate_9000"/>
- <elementType ref="org.eclipse.papyrus.diagram.statemachine.Pseudostate_10000"/>
- <elementType ref="org.eclipse.papyrus.diagram.statemachine.Pseudostate_11000"/>
- <elementType ref="org.eclipse.papyrus.diagram.statemachine.Pseudostate_12000"/>
- <elementType ref="org.eclipse.papyrus.diagram.statemachine.Pseudostate_13000"/>
- <elementType ref="org.eclipse.papyrus.diagram.statemachine.Pseudostate_14000"/>
- <elementType ref="org.eclipse.papyrus.diagram.statemachine.Pseudostate_15000"/>
- <elementType ref="org.eclipse.papyrus.diagram.statemachine.Pseudostate_16000"/>
- <elementType ref="org.eclipse.papyrus.diagram.statemachine.Pseudostate_17000"/>
- <elementType ref="org.eclipse.papyrus.diagram.statemachine.ConnectionPointReference_18000"/>
- <elementType ref="org.eclipse.papyrus.diagram.statemachine.Transition_7000"/>
- <elementType ref="org.eclipse.papyrus.diagram.statemachine.Generalization_19000"/>
- <advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
- </binding>
- </extension>
- <extension point="org.eclipse.core.expressions.propertyTesters" id="navigator-proptest.isURIEditorInput">
- <?gmfgen generated="true"?>
- <propertyTester
- id="org.eclipse.papyrus.diagram.statemachine.URIEditorInputPropertyTester"
- type="org.eclipse.emf.common.ui.URIEditorInput"
- namespace="org.eclipse.papyrus.diagram.statemachine"
- properties="isURIEditorInput"
- class="org.eclipse.papyrus.diagram.statemachine.part.UMLUriEditorInputTester">
- </propertyTester>
- </extension>
-
- <extension point="org.eclipse.ui.navigator.viewer" id="navigator-viewbinding">
- <?gmfgen generated="true"?>
- <viewerContentBinding viewerId="org.eclipse.ui.navigator.ProjectExplorer">
- <includes>
- <contentExtension pattern="org.eclipse.papyrus.diagram.statemachine.resourceContent"/>
- <contentExtension pattern="org.eclipse.papyrus.diagram.statemachine.domainResourceContent"/>
- <contentExtension pattern="org.eclipse.papyrus.diagram.statemachine.navigatorLinkHelper"/>
- </includes>
- </viewerContentBinding>
- <viewerActionBinding viewerId="org.eclipse.ui.navigator.ProjectExplorer">
- <includes>
- <actionExtension pattern="org.eclipse.papyrus.diagram.statemachine.navigatorActionProvider"/>
- </includes>
- </viewerActionBinding>
- </extension>
-
- <extension point="org.eclipse.ui.navigator.navigatorContent" id="navigator-content">
- <?gmfgen generated="true"?>
- <navigatorContent
- id="org.eclipse.papyrus.diagram.statemachine.resourceContent"
- name="%navigatorContentName"
- priority="normal"
- contentProvider="org.eclipse.papyrus.diagram.statemachine.navigator.UMLNavigatorContentProvider"
- labelProvider="org.eclipse.papyrus.diagram.statemachine.navigator.UMLNavigatorLabelProvider"
- icon="icons/UMLDiagramFile.gif"
- activeByDefault="true">
- <triggerPoints>
- <or>
- <and>
- <instanceof value="org.eclipse.core.resources.IFile"/>
- <test property="org.eclipse.core.resources.extension" value="PapyrusUMLStateMachine_diagram"/>
- </and>
- <instanceof value="org.eclipse.papyrus.diagram.statemachine.navigator.UMLAbstractNavigatorItem"/>
- </or>
- </triggerPoints>
- <possibleChildren>
- <or>
- <instanceof value="org.eclipse.papyrus.diagram.statemachine.navigator.UMLAbstractNavigatorItem"/>
- </or>
- </possibleChildren>
- <commonSorter
- id="org.eclipse.papyrus.diagram.statemachine.navigatorSorter"
- class="org.eclipse.papyrus.diagram.statemachine.navigator.UMLNavigatorSorter">
- <parentExpression>
- <or>
- <and>
- <instanceof value="org.eclipse.core.resources.IFile"/>
- <test property="org.eclipse.core.resources.extension" value="PapyrusUMLStateMachine_diagram"/>
- </and>
- <instanceof value="org.eclipse.papyrus.diagram.statemachine.navigator.UMLAbstractNavigatorItem"/>
- </or>
- </parentExpression>
- </commonSorter>
- </navigatorContent>
- <navigatorContent
- id="org.eclipse.papyrus.diagram.statemachine.domainResourceContent"
- name="%domainNavigatorContentName"
- priority="normal"
- contentProvider="org.eclipse.papyrus.diagram.statemachine.navigator.UMLDomainNavigatorContentProvider"
- labelProvider="org.eclipse.papyrus.diagram.statemachine.navigator.UMLDomainNavigatorLabelProvider"
- icon="icons/UMLDiagramFile.gif"
- activeByDefault="true">
- <triggerPoints>
- <or>
- <and>
- <instanceof value="org.eclipse.core.resources.IFile"/>
- <test property="org.eclipse.core.resources.extension" value="PapyrusUMLStateMachine"/>
- </and>
- <instanceof value="org.eclipse.papyrus.diagram.statemachine.navigator.UMLDomainNavigatorItem"/>
- </or>
- </triggerPoints>
- <possibleChildren>
- <instanceof value="org.eclipse.papyrus.diagram.statemachine.navigator.UMLDomainNavigatorItem"/>
- </possibleChildren>
- </navigatorContent>
- <actionProvider
- id="org.eclipse.papyrus.diagram.statemachine.navigatorActionProvider"
- class="org.eclipse.papyrus.diagram.statemachine.navigator.UMLNavigatorActionProvider">
- <enablement>
- <or>
- <instanceof value="org.eclipse.papyrus.diagram.statemachine.navigator.UMLAbstractNavigatorItem"/>
- </or>
- </enablement>
- </actionProvider>
- </extension>
-
- <extension point="org.eclipse.ui.navigator.linkHelper" id="navigator-linkhelper">
- <?gmfgen generated="true"?>
- <linkHelper
- id="org.eclipse.papyrus.diagram.statemachine.navigatorLinkHelper"
- class="org.eclipse.papyrus.diagram.statemachine.navigator.UMLNavigatorLinkHelper">
- <editorInputEnablement>
- <and>
- <instanceof value="org.eclipse.emf.common.ui.URIEditorInput"/>
- <test property="org.eclipse.papyrus.diagram.statemachine.isURIEditorInput"/>
- </and>
- </editorInputEnablement>
- <selectionEnablement>
- <instanceof value="org.eclipse.papyrus.diagram.statemachine.navigator.UMLAbstractNavigatorItem"/>
- </selectionEnablement>
- </linkHelper>
- </extension>
- <extension point="org.eclipse.ui.commands" id="update-cmd">
- <?gmfgen generated="true"?>
- <command
- categoryId="org.eclipse.ui.category.edit"
- defaultHandler="org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramUpdateCommand"
- description="%update.diagram.description"
- id="org.eclipse.papyrus.diagram.statemachine.updateDiagram"
- name="%update.diagram.name"/>
- </extension>
-
- <extension point="org.eclipse.ui.bindings" id="update-cmd-binding">
- <?gmfgen generated="true"?>
- <key
- commandId="org.eclipse.papyrus.diagram.statemachine.updateDiagram"
- contextId="org.eclipse.papyrus.diagram.statemachine.ui.diagramContext"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="F5"/>
- </extension>
-
- <extension point="org.eclipse.ui.menus" id="context-menus">
- <?gmfgen generated="true"?>
- <!-- menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=">
- </menuContribution>
- <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar?after=">
- </menuContribution -->
- <menuContribution locationURI="popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu">
- <command commandId="org.eclipse.papyrus.diagram.statemachine.LoadResourceAction">
- <visibleWhen>
- <and>
- <with variable="activePartId"><equals value="org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorID"/></with>
- <with variable="selection"><iterate ifEmpty="false">
- <instanceof value="org.eclipse.papyrus.diagram.statemachine.edit.parts.PackageEditPart"/>
- </iterate></with>
- </and>
- </visibleWhen>
- </command>
- </menuContribution>
- </extension>
-
- <extension point="org.eclipse.ui.commands" id="menu-commands">
- <?gmfgen generated="true"?>
- <category id="org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorID" name="%cmdcategory.name" description="%cmdcategory.desc"/>
- <command id="org.eclipse.papyrus.diagram.statemachine.LoadResourceAction"
- name="Load Resource"
- categoryId="org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorID"
- defaultHandler="org.eclipse.papyrus.diagram.statemachine.part.LoadResourceAction"/>
- </extension>
-
-<!-- Diagram creation command and handler -->
-<extension point="org.eclipse.ui.commands">
- <command id="org.eclipse.papyrus.diagram.statemachine.CreationCommand"
- name="Create a new StateMachine Diagram"
- description="Create a new StateMachine Diagram"
- categoryId="org.eclipse.papyrus.editor.category"/>
-</extension>
-
- <extension point="org.eclipse.ui.handlers">
- <handler
- class="org.eclipse.papyrus.diagram.statemachine.CreateStateMachineDiagramWithNavigationHandler"
- commandId="org.eclipse.papyrus.diagram.statemachine.CreationCommand">
- <activeWhen>
- <with variable="activeEditorId">
- <equals value="org.eclipse.papyrus.core.papyrusEditor" />
- </with>
- </activeWhen>
- </handler>
- </extension>
-
-<!-- Diagram creation command registration in menu and toolbar -->
-<extension point="org.eclipse.ui.menus">
-
- <menuContribution locationURI="menu:org.eclipse.papyrus.ui.menu">
- <menu id="org.eclipse.papyrus.diagram.ui.menu.diagrams" label="Diagrams">
- <command commandId="org.eclipse.papyrus.diagram.statemachine.CreationCommand"
- icon="icons/obj16/Diagram_StateMachine.gif" label="Create a new StateMachine Diagram"
- style="push" tooltip="Create a new StateMachine Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.diagram.common.IsPapyrusActiveWithUMLModel"/>
- </visibleWhen>
- </command>
- </menu>
- </menuContribution>
-
- <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar">
- <toolbar id="org.eclipse.papyrus.diagram.ui.toolbar">
- <command commandId="org.eclipse.papyrus.diagram.statemachine.CreationCommand"
- icon="icons/obj16/Diagram_StateMachine.gif" label="Create a new StateMachine Diagram"
- style="push" tooltip="Create a new StateMachine Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.diagram.common.IsPapyrusActiveWithUMLModel"/>
- </visibleWhen>
- </command>
- </toolbar>
- </menuContribution>
-
- <menuContribution locationURI="popup:org.eclipse.papyrus.modelexplorer.popupmenu.creatediagram">
- <command commandId="org.eclipse.papyrus.diagram.statemachine.CreationCommand"
- icon="icons/obj16/Diagram_StateMachine.gif"
- label="Create a new StateMachine Diagram"
- style="push"
- tooltip="Create a new StateMachine Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.diagram.common.IsPapyrusActiveWithUMLModel"/>
- </visibleWhen>
- </command>
- </menuContribution>
-
-</extension>
-
- <extension
- point="org.eclipse.papyrus.core.papyrusDiagram">
- <editorDiagram
- actionBarContributorId="org.eclipse.papyrus.diagram.common.part.UMLDiagramActionBarContributor"
- factoryClass="org.eclipse.papyrus.diagram.statemachine.StateMachineDiagramEditorFactory"
- icon="icons/obj16/Diagram_StateMachine.gif">
- </editorDiagram>
- <creationCommand
- creationCommandClass="org.eclipse.papyrus.diagram.statemachine.CreateStateMachineDiagramCommand"
- creationCondition="org.eclipse.papyrus.diagram.statemachine.StateMachineDiagramCreationCondition"
- icon="icons/obj16/Diagram_StateMachine.gif"
- id="org.eclipse.papyrus.diagram.statemachine.CreationCommand"
- language="uml"
- label="UML StateMachine Diagram">
- </creationCommand>
- </extension>
-
-<extension
- point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders">
- <editpartProvider
- class="org.eclipse.papyrus.diagram.statemachine.custom.providers.CustomUMLEditPartProvider">
- <Priority
- name="Highest">
- </Priority>
- <object
- class="org.eclipse.gmf.runtime.notation.Diagram"
- id="generated-diagram">
- <method
- name="getType()"
- value="PapyrusUMLStateMachineDiagram">
- </method>
- </object>
- <object
- class="org.eclipse.gmf.runtime.notation.Node"
- id="generated-nodes">
- <method
- name="getType()"
- value="2000,3000,4000">
- </method>
- </object>
- <object
- class="org.eclipse.gmf.runtime.notation.Edge"
- id="generated-links">
- <method
- name="getType()">
- </method>
- </object>
- <object
- class="org.eclipse.gmf.runtime.notation.Node"
- id="generated-labels">
- <method
- name="getType()"
- value="2001,3001">
- </method>
- </object>
- <object
- class="org.eclipse.gmf.runtime.notation.Node"
- id="generated-compartments">
- <method
- name="getType()"
- value="3002,2002,4002">
- </method>
- </object>
- <context
- views="generated-diagram,generated-nodes,generated-links,generated-labels,generated-compartments">
- </context>
- </editpartProvider>
-</extension>
-
-
-<extension point="org.eclipse.ui.preferencePages">
-
-
-
- <?gmfgen generated="true"?>
- <page category="org.eclipse.papyrus.preferences.diagrams.PapyrusUMLStateMachineDiagram"
- class="org.eclipse.papyrus.diagram.statemachine.preferences.PseudostatePreferencePage"
- id="org.eclipse.papyrus.diagram.statemachine.preferences.PseudostatePreferencePage"
- name="Pseudostate Node" />
-
-
- <?gmfgen generated="true"?>
- <page category="org.eclipse.papyrus.preferences.diagrams.PapyrusUMLStateMachineDiagram"
- class="org.eclipse.papyrus.diagram.statemachine.preferences.ConnectionPointReferencePreferencePage"
- id="org.eclipse.papyrus.diagram.statemachine.preferences.ConnectionPointReferencePreferencePage"
- name="ConnectionPointReference Node" />
-
-
- <?gmfgen generated="true"?>
- <page category="org.eclipse.papyrus.preferences.diagrams.PapyrusUMLStateMachineDiagram"
- class="org.eclipse.papyrus.diagram.statemachine.preferences.RegionPreferencePage"
- id="org.eclipse.papyrus.diagram.statemachine.preferences.RegionPreferencePage"
- name="Region Node" />
-
-
- <?gmfgen generated="true"?>
- <page category="org.eclipse.papyrus.preferences.diagrams.PapyrusUMLStateMachineDiagram"
- class="org.eclipse.papyrus.diagram.statemachine.preferences.StatePreferencePage"
- id="org.eclipse.papyrus.diagram.statemachine.preferences.StatePreferencePage"
- name="State Node" />
-
-
- <?gmfgen generated="true"?>
- <page category="org.eclipse.papyrus.preferences.diagrams.PapyrusUMLStateMachineDiagram"
- class="org.eclipse.papyrus.diagram.statemachine.preferences.FinalStatePreferencePage"
- id="org.eclipse.papyrus.diagram.statemachine.preferences.FinalStatePreferencePage"
- name="FinalState Node" />
-
-
- <?gmfgen generated="true"?>
- <page category="org.eclipse.papyrus.preferences.diagrams.PapyrusUMLStateMachineDiagram"
- class="org.eclipse.papyrus.diagram.statemachine.preferences.StateMachinePreferencePage"
- id="org.eclipse.papyrus.diagram.statemachine.preferences.StateMachinePreferencePage"
- name="StateMachine Node" />
-
-
-
-
-
- <?gmfgen generated="true"?>
- <page category="org.eclipse.papyrus.preferences.diagrams.PapyrusUMLStateMachineDiagram"
- class="org.eclipse.papyrus.diagram.statemachine.preferences.GeneralizationPreferencePage"
- id="org.eclipse.papyrus.diagram.statemachine.preferences.GeneralizationPreferencePage"
- name="Generalization Link" />
-
-
-
- <?gmfgen generated="true"?>
- <page category="org.eclipse.papyrus.preferences.diagrams.PapyrusUMLStateMachineDiagram"
- class="org.eclipse.papyrus.diagram.statemachine.preferences.TransitionPreferencePage"
- id="org.eclipse.papyrus.diagram.statemachine.preferences.TransitionPreferencePage"
- name="Transition Link" />
-
-
-</extension>
-<extension
- id="PapyrusUMLStateMachineDiagram.palettedefinition"
- name="PapyrusUMLStateMachineDiagram Predefined Entries"
- point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders">
-
- <?gmfgen generated="true"?>
- <paletteProvider class="org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider">
- <Priority name="Lowest"/>
- <contribution
- factoryClass="org.eclipse.papyrus.diagram.statemachine.part.UMLPaletteFactory">
- <predefinedEntry id="standardGroup/noteStack/noteTool" remove="true"/>
- <predefinedEntry id="standardGroup/noteStack/textTool" remove="true"/>
- <predefinedEntry id="standardGroup/noteStack/noteattachmentTool" remove="true"/>
- <entry
- defineOnly="true"
- description="Region"
- id="createRegionCreationTool"
- kind="tool"
- label="Region"
- large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Region.gif"
- path=""
- small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Region.gif">
- </entry>
- <entry
- defineOnly="true"
- description="State"
- id="createStateCreationTool"
- kind="tool"
- label="State"
- large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/State.gif"
- path=""
- small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/State.gif">
- </entry>
- <entry
- defineOnly="true"
- description="Initial"
- id="createInitialCreationTool"
- kind="tool"
- label="Initial"
- large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_initial.gif"
- path=""
- small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_initial.gif">
- </entry>
- <entry
- defineOnly="true"
- description="FinalState"
- id="createFinalStateCreationTool"
- kind="tool"
- label="FinalState"
- large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/FinalState.gif"
- path=""
- small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/FinalState.gif">
- </entry>
- <entry
- defineOnly="true"
- description="ShallowHistory"
- id="createShallowHistoryCreationTool"
- kind="tool"
- label="ShallowHistory"
- large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_shallowHistory.gif"
- path=""
- small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_shallowHistory.gif">
- </entry>
- <entry
- defineOnly="true"
- description="DeepHistory"
- id="createDeepHistoryCreationTool"
- kind="tool"
- label="DeepHistory"
- large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_deepHistory.gif"
- path=""
- small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_deepHistory.gif">
- </entry>
- <entry
- defineOnly="true"
- description="Fork"
- id="createForkCreationTool"
- kind="tool"
- label="Fork"
- large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_fork.gif"
- path=""
- small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_fork.gif">
- </entry>
- <entry
- defineOnly="true"
- description="Join"
- id="createJoinCreationTool"
- kind="tool"
- label="Join"
- large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_join.gif"
- path=""
- small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_join.gif">
- </entry>
- <entry
- defineOnly="true"
- description="Choice"
- id="createChoiceCreationTool"
- kind="tool"
- label="Choice"
- large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_choice.gif"
- path=""
- small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_choice.gif">
- </entry>
- <entry
- defineOnly="true"
- description="Junction"
- id="createJunctionCreationTool"
- kind="tool"
- label="Junction"
- large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_junction.gif"
- path=""
- small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_junction.gif">
- </entry>
- <entry
- defineOnly="true"
- description="EntryPoint"
- id="createEntryPointCreationTool"
- kind="tool"
- label="EntryPoint"
- large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_entryPoint.gif"
- path=""
- small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_entryPoint.gif">
- </entry>
- <entry
- defineOnly="true"
- description="ExitPoint"
- id="createExitPointCreationTool"
- kind="tool"
- label="ExitPoint"
- large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_exitPoint.gif"
- path=""
- small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_exitPoint.gif">
- </entry>
- <entry
- defineOnly="true"
- description="Terminate"
- id="createTerminateCreationTool"
- kind="tool"
- label="Terminate"
- large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_terminate.gif"
- path=""
- small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Pseudostate_terminate.gif">
- </entry>
- <entry
- defineOnly="true"
- description="ConnectionPointReference"
- id="createConnectionPointReferenceCreationTool"
- kind="tool"
- label="ConnectionPointReference"
- large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ConnectionPointReference.gif"
- path=""
- small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ConnectionPointReference.gif">
- </entry>
- <entry
- defineOnly="true"
- description="Transition"
- id="createTransitionCreationTool"
- kind="tool"
- label="Transition"
- large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Transition_local.gif"
- path=""
- small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Transition_local.gif">
- </entry>
-
- </contribution>
- </paletteProvider>
-
- </extension>
-
-<extension point="org.eclipse.ui.handlers" id="menu-handlers">
- <?gmfgen generated="true"?>
- </extension>
-<extension
- id="ui-context"
- point="org.eclipse.ui.contexts">
- <context
- description="%context.description"
- id="org.eclipse.papyrus.diagram.statemachine.ui.diagramContext"
- name="%context.name"
- parentId="org.eclipse.gmf.runtime.diagram.ui.diagramContext">
- </context>
-</extension>
-<extension
- id="PapyrusUMLStateMachineDiagram.standard"
- name="PapyrusUMLStateMachineDiagram Standard Palette"
- point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders">
-
- <?gmfgen generated="true"?>
- <paletteProvider class="org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider">
- <Priority name="Low"/>
- <contribution
- factoryClass="org.eclipse.papyrus.diagram.statemachine.part.UMLPaletteFactory">
- <predefinedEntry id="standardGroup/noteStack/noteTool" remove="true"/>
- <predefinedEntry id="standardGroup/noteStack/textTool" remove="true"/>
- <predefinedEntry id="standardGroup/noteStack/noteattachmentTool" remove="true"/>
- <entry
- description=""
- id="createNodesGroup"
- kind="drawer"
- label="Nodes"
- large_icon="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif"
- path="/"
- small_icon="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif">
- <expand
- force="true">
- </expand>
- </entry>
-
- <predefinedEntry
- id="createRegionCreationTool"
- path="/createNodesGroup">
- </predefinedEntry>
- <predefinedEntry
- id="createStateCreationTool"
- path="/createNodesGroup">
- </predefinedEntry>
- <predefinedEntry
- id="createInitialCreationTool"
- path="/createNodesGroup">
- </predefinedEntry>
- <predefinedEntry
- id="createFinalStateCreationTool"
- path="/createNodesGroup">
- </predefinedEntry>
- <predefinedEntry
- id="createShallowHistoryCreationTool"
- path="/createNodesGroup">
- </predefinedEntry>
- <predefinedEntry
- id="createDeepHistoryCreationTool"
- path="/createNodesGroup">
- </predefinedEntry>
- <predefinedEntry
- id="createForkCreationTool"
- path="/createNodesGroup">
- </predefinedEntry>
- <predefinedEntry
- id="createJoinCreationTool"
- path="/createNodesGroup">
- </predefinedEntry>
- <predefinedEntry
- id="createChoiceCreationTool"
- path="/createNodesGroup">
- </predefinedEntry>
- <predefinedEntry
- id="createJunctionCreationTool"
- path="/createNodesGroup">
- </predefinedEntry>
- <predefinedEntry
- id="createEntryPointCreationTool"
- path="/createNodesGroup">
- </predefinedEntry>
- <predefinedEntry
- id="createExitPointCreationTool"
- path="/createNodesGroup">
- </predefinedEntry>
- <predefinedEntry
- id="createTerminateCreationTool"
- path="/createNodesGroup">
- </predefinedEntry>
- <predefinedEntry
- id="createConnectionPointReferenceCreationTool"
- path="/createNodesGroup">
- </predefinedEntry>
-
- <entry
- description=""
- id="createEdgesGroup"
- kind="drawer"
- label="Edges"
- large_icon="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif"
- path="/"
- small_icon="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif">
- <expand
- force="true">
- </expand>
- </entry>
-
- <predefinedEntry
- id="createTransitionCreationTool"
- path="/createEdgesGroup">
- </predefinedEntry>
-
-
- </contribution>
- <editor id="org.eclipse.papyrus.diagram.statemachine"/>
- </paletteProvider>
-
- </extension>
-<extension id="validationDecoratorProvider" name="ValidationDecorations" point="org.eclipse.gmf.runtime.diagram.ui.decoratorProviders">
- <?gmfgen generated="true"?>
- <decoratorProvider class="org.eclipse.papyrus.diagram.statemachine.providers.UMLValidationDecoratorProvider">
- <Priority name="Lowest"/>
- <object class="org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart(org.eclipse.gmf.runtime.diagram.ui)" id="PRIMARY_VIEW"/>
- <context decoratorTargets="PRIMARY_VIEW"/>
- </decoratorProvider>
- </extension>
-
-
-
-
-
-
-
-
- <!-- optionally, specify keybindings -->
-</plugin>
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/ConnectionPointReferenceCreateCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/ConnectionPointReferenceCreateCommand.java
deleted file mode 100644
index 7b2e9f8081e..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/ConnectionPointReferenceCreateCommand.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.papyrus.diagram.statemachine.providers.ElementInitializers;
-import org.eclipse.uml2.uml.ConnectionPointReference;
-import org.eclipse.uml2.uml.State;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class ConnectionPointReferenceCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- public static ConnectionPointReferenceCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ConnectionPointReferenceCreateCommand(req, eObject);
- }
-
- /**
- * @generated
- */
- private EClass eClass = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public ConnectionPointReferenceCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-
- /**
- * @generated
- */
- public ConnectionPointReferenceCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
- }
-
- /**
- * @generated
- */
- public boolean canExecute() {
-
- return true;
-
- }
-
- /**
- * @generated
- */
- protected void doConfigure(ConnectionPointReference newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if(configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-
- /**
- * @generated
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- ConnectionPointReference newElement = UMLFactory.eINSTANCE.createConnectionPointReference();
-
- State owner = (State)getElementToEdit();
- owner.getConnections().add(newElement);
-
- ElementInitializers.getInstance().init_ConnectionPointReference_18000(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest)getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- protected EObject getElementToEdit() {
-
- EObject container = ((CreateElementRequest)getRequest()).getContainer();
- if(container instanceof View) {
- container = ((View)container).getElement();
- }
- if(container != null) {
- return container;
- }
- return eObject;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/FinalStateCreateCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/FinalStateCreateCommand.java
deleted file mode 100644
index 2cc1226f2a2..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/FinalStateCreateCommand.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.papyrus.diagram.statemachine.providers.ElementInitializers;
-import org.eclipse.uml2.uml.FinalState;
-import org.eclipse.uml2.uml.Region;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class FinalStateCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- public static FinalStateCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new FinalStateCreateCommand(req, eObject);
- }
-
- /**
- * @generated
- */
- private EClass eClass = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public FinalStateCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-
- /**
- * @generated
- */
- public FinalStateCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
- }
-
- /**
- * @generated
- */
- public boolean canExecute() {
-
- return true;
-
- }
-
- /**
- * @generated
- */
- protected void doConfigure(FinalState newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if(configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-
- /**
- * @generated
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- FinalState newElement = UMLFactory.eINSTANCE.createFinalState();
-
- Region owner = (Region)getElementToEdit();
- owner.getSubvertices().add(newElement);
-
- ElementInitializers.getInstance().init_FinalState_5000(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest)getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- protected EObject getElementToEdit() {
-
- EObject container = ((CreateElementRequest)getRequest()).getContainer();
- if(container instanceof View) {
- container = ((View)container).getElement();
- }
- if(container != null) {
- return container;
- }
- return eObject;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/GeneralizationCreateCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/GeneralizationCreateCommand.java
deleted file mode 100644
index d3b4775c9a7..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/GeneralizationCreateCommand.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.diagram.statemachine.edit.policies.UMLBaseItemSemanticEditPolicy;
-import org.eclipse.uml2.uml.Classifier;
-import org.eclipse.uml2.uml.Generalization;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class GeneralizationCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- protected final EObject source;
-
- /**
- * @generated
- */
- protected final EObject target;
-
- /**
- * @generated
- */
- public GeneralizationCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
- super(request.getLabel(), null, request);
- this.source = source;
- this.target = target;
- }
-
- /**
- * @generated
- */
- public boolean canExecute() {
- if(source == null && target == null) {
- return false;
- }
- if(source != null && false == source instanceof Classifier) {
- return false;
- }
- if(target != null && false == target instanceof Classifier) {
- 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
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canCreateGeneralization_19000(getSource(), getTarget());
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Generalization newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- configureRequest.setParameter(CreateRelationshipRequest.SOURCE, getSource());
- configureRequest.setParameter(CreateRelationshipRequest.TARGET, getTarget());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if(configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-
- /**
- * @generated
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- if(!canExecute()) {
- throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
- }
-
- Generalization newElement = UMLFactory.eINSTANCE.createGeneralization();
- getSource().getGeneralizations().add(newElement);
- newElement.setGeneral(getTarget());
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest)getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
-
- }
-
- /**
- * @generated
- */
- protected Classifier getSource() {
- return (Classifier)source;
- }
-
- /**
- * @generated
- */
- protected Classifier getTarget() {
- return (Classifier)target;
- }
-
- /**
- * @generated
- */
- protected void setElementToEdit(EObject element) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/GeneralizationReorientCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/GeneralizationReorientCommand.java
deleted file mode 100644
index 43b3e8fa5f3..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/GeneralizationReorientCommand.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.papyrus.diagram.statemachine.edit.policies.UMLBaseItemSemanticEditPolicy;
-import org.eclipse.uml2.uml.Classifier;
-import org.eclipse.uml2.uml.Generalization;
-
-/**
- * @generated
- */
-public class GeneralizationReorientCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private final int reorientDirection;
-
- /**
- * @generated
- */
- private final EObject oldEnd;
-
- /**
- * @generated
- */
- private final EObject newEnd;
-
- /**
- * @generated
- */
- public GeneralizationReorientCommand(ReorientRelationshipRequest request) {
- super(request.getLabel(), request.getRelationship(), request);
- reorientDirection = request.getDirection();
- oldEnd = request.getOldRelationshipEnd();
- newEnd = request.getNewRelationshipEnd();
- }
-
- /**
- * @generated
- */
- public boolean canExecute() {
- if(false == getElementToEdit() instanceof Generalization) {
- return false;
- }
- if(reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
- return canReorientSource();
- }
- if(reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
- return canReorientTarget();
- }
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean canReorientSource() {
- if(!(oldEnd instanceof Classifier && newEnd instanceof Classifier)) {
- return false;
- }
- Classifier target = getLink().getGeneral();
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistGeneralization_19000(getLink(), getNewSource(), target);
- }
-
- /**
- * @generated
- */
- protected boolean canReorientTarget() {
- if(!(oldEnd instanceof Classifier && newEnd instanceof Classifier)) {
- return false;
- }
- if(!(getLink().eContainer() instanceof Classifier)) {
- return false;
- }
- Classifier source = (Classifier)getLink().eContainer();
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistGeneralization_19000(getLink(), source, getNewTarget());
- }
-
- /**
- * @generated
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- if(!canExecute()) {
- throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
- }
- if(reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
- return reorientSource();
- }
- if(reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
- return reorientTarget();
- }
- throw new IllegalStateException();
- }
-
- /**
- * @generated
- */
- protected Generalization getLink() {
- return (Generalization)getElementToEdit();
- }
-
- /**
- * @generated
- */
- protected Classifier getNewSource() {
- return (Classifier)newEnd;
- }
-
- /**
- * @generated
- */
- protected Classifier getNewTarget() {
- return (Classifier)newEnd;
- }
-
- /**
- * @generated
- */
- protected Classifier getOldSource() {
- return (Classifier)oldEnd;
- }
-
- /**
- * @generated
- */
- protected Classifier getOldTarget() {
- return (Classifier)oldEnd;
- }
-
- /**
- * @generated
- */
- protected CommandResult reorientSource() throws ExecutionException {
- getOldSource().getGeneralizations().remove(getLink());
- getNewSource().getGeneralizations().add(getLink());
- return CommandResult.newOKCommandResult(getLink());
- }
-
- /**
- * @generated
- */
- protected CommandResult reorientTarget() throws ExecutionException {
- getLink().setGeneral(getNewTarget());
- return CommandResult.newOKCommandResult(getLink());
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateChoiceCreateCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateChoiceCreateCommand.java
deleted file mode 100644
index 6d161b8d8ab..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateChoiceCreateCommand.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.papyrus.diagram.statemachine.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Pseudostate;
-import org.eclipse.uml2.uml.Region;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class PseudostateChoiceCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- public static PseudostateChoiceCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PseudostateChoiceCreateCommand(req, eObject);
- }
-
- /**
- * @generated
- */
- private EClass eClass = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public PseudostateChoiceCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-
- /**
- * @generated
- */
- public PseudostateChoiceCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
- }
-
- /**
- * @generated
- */
- public boolean canExecute() {
-
- return true;
-
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Pseudostate newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if(configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-
- /**
- * @generated
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Pseudostate newElement = UMLFactory.eINSTANCE.createPseudostate();
-
- Region owner = (Region)getElementToEdit();
- owner.getSubvertices().add(newElement);
-
- ElementInitializers.getInstance().init_Pseudostate_11000(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest)getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- protected EObject getElementToEdit() {
-
- EObject container = ((CreateElementRequest)getRequest()).getContainer();
- if(container instanceof View) {
- container = ((View)container).getElement();
- }
- if(container != null) {
- return container;
- }
- return eObject;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateDeepHistoryCreateCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateDeepHistoryCreateCommand.java
deleted file mode 100644
index a65b970e7c1..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateDeepHistoryCreateCommand.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.papyrus.diagram.statemachine.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Pseudostate;
-import org.eclipse.uml2.uml.Region;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class PseudostateDeepHistoryCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- public static PseudostateDeepHistoryCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PseudostateDeepHistoryCreateCommand(req, eObject);
- }
-
- /**
- * @generated
- */
- private EClass eClass = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public PseudostateDeepHistoryCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-
- /**
- * @generated
- */
- public PseudostateDeepHistoryCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
- }
-
- /**
- * @generated
- */
- public boolean canExecute() {
-
- return true;
-
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Pseudostate newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if(configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-
- /**
- * @generated
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Pseudostate newElement = UMLFactory.eINSTANCE.createPseudostate();
-
- Region owner = (Region)getElementToEdit();
- owner.getSubvertices().add(newElement);
-
- ElementInitializers.getInstance().init_Pseudostate_14000(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest)getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- protected EObject getElementToEdit() {
-
- EObject container = ((CreateElementRequest)getRequest()).getContainer();
- if(container instanceof View) {
- container = ((View)container).getElement();
- }
- if(container != null) {
- return container;
- }
- return eObject;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateEntryPointCreateCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateEntryPointCreateCommand.java
deleted file mode 100644
index f7fd57a1ce3..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateEntryPointCreateCommand.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.papyrus.diagram.statemachine.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Pseudostate;
-import org.eclipse.uml2.uml.StateMachine;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class PseudostateEntryPointCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- public static PseudostateEntryPointCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PseudostateEntryPointCreateCommand(req, eObject);
- }
-
- /**
- * @generated
- */
- private EClass eClass = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public PseudostateEntryPointCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-
- /**
- * @generated
- */
- public PseudostateEntryPointCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
- }
-
- /**
- * @generated
- */
- public boolean canExecute() {
-
- return true;
-
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Pseudostate newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if(configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-
- /**
- * @generated
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Pseudostate newElement = UMLFactory.eINSTANCE.createPseudostate();
-
- StateMachine owner = (StateMachine)getElementToEdit();
- owner.getConnectionPoints().add(newElement);
-
- ElementInitializers.getInstance().init_Pseudostate_16000(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest)getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- protected EObject getElementToEdit() {
-
- EObject container = ((CreateElementRequest)getRequest()).getContainer();
- if(container instanceof View) {
- container = ((View)container).getElement();
- }
- if(container != null) {
- return container;
- }
- return eObject;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateExitPointCreateCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateExitPointCreateCommand.java
deleted file mode 100644
index e1e48c9e2a9..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateExitPointCreateCommand.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.papyrus.diagram.statemachine.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Pseudostate;
-import org.eclipse.uml2.uml.StateMachine;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class PseudostateExitPointCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- public static PseudostateExitPointCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PseudostateExitPointCreateCommand(req, eObject);
- }
-
- /**
- * @generated
- */
- private EClass eClass = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public PseudostateExitPointCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-
- /**
- * @generated
- */
- public PseudostateExitPointCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
- }
-
- /**
- * @generated
- */
- public boolean canExecute() {
-
- return true;
-
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Pseudostate newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if(configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-
- /**
- * @generated
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Pseudostate newElement = UMLFactory.eINSTANCE.createPseudostate();
-
- StateMachine owner = (StateMachine)getElementToEdit();
- owner.getConnectionPoints().add(newElement);
-
- ElementInitializers.getInstance().init_Pseudostate_17000(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest)getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- protected EObject getElementToEdit() {
-
- EObject container = ((CreateElementRequest)getRequest()).getContainer();
- if(container instanceof View) {
- container = ((View)container).getElement();
- }
- if(container != null) {
- return container;
- }
- return eObject;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateForkCreateCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateForkCreateCommand.java
deleted file mode 100644
index 986c2bab48e..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateForkCreateCommand.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.papyrus.diagram.statemachine.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Pseudostate;
-import org.eclipse.uml2.uml.Region;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class PseudostateForkCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- public static PseudostateForkCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PseudostateForkCreateCommand(req, eObject);
- }
-
- /**
- * @generated
- */
- private EClass eClass = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public PseudostateForkCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-
- /**
- * @generated
- */
- public PseudostateForkCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
- }
-
- /**
- * @generated
- */
- public boolean canExecute() {
-
- return true;
-
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Pseudostate newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if(configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-
- /**
- * @generated
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Pseudostate newElement = UMLFactory.eINSTANCE.createPseudostate();
-
- Region owner = (Region)getElementToEdit();
- owner.getSubvertices().add(newElement);
-
- ElementInitializers.getInstance().init_Pseudostate_10000(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest)getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- protected EObject getElementToEdit() {
-
- EObject container = ((CreateElementRequest)getRequest()).getContainer();
- if(container instanceof View) {
- container = ((View)container).getElement();
- }
- if(container != null) {
- return container;
- }
- return eObject;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateInitialCreateCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateInitialCreateCommand.java
deleted file mode 100644
index ecfd6c7fb89..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateInitialCreateCommand.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.papyrus.diagram.statemachine.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Pseudostate;
-import org.eclipse.uml2.uml.Region;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class PseudostateInitialCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- public static PseudostateInitialCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PseudostateInitialCreateCommand(req, eObject);
- }
-
- /**
- * @generated
- */
- private EClass eClass = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public PseudostateInitialCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-
- /**
- * @generated
- */
- public PseudostateInitialCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
- }
-
- /**
- * @generated
- */
- public boolean canExecute() {
-
- return true;
-
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Pseudostate newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if(configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-
- /**
- * @generated
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Pseudostate newElement = UMLFactory.eINSTANCE.createPseudostate();
-
- Region owner = (Region)getElementToEdit();
- owner.getSubvertices().add(newElement);
-
- ElementInitializers.getInstance().init_Pseudostate_8000(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest)getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- protected EObject getElementToEdit() {
-
- EObject container = ((CreateElementRequest)getRequest()).getContainer();
- if(container instanceof View) {
- container = ((View)container).getElement();
- }
- if(container != null) {
- return container;
- }
- return eObject;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateJoinCreateCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateJoinCreateCommand.java
deleted file mode 100644
index f50b54e4dbe..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateJoinCreateCommand.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.papyrus.diagram.statemachine.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Pseudostate;
-import org.eclipse.uml2.uml.Region;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class PseudostateJoinCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- public static PseudostateJoinCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PseudostateJoinCreateCommand(req, eObject);
- }
-
- /**
- * @generated
- */
- private EClass eClass = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public PseudostateJoinCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-
- /**
- * @generated
- */
- public PseudostateJoinCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
- }
-
- /**
- * @generated
- */
- public boolean canExecute() {
-
- return true;
-
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Pseudostate newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if(configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-
- /**
- * @generated
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Pseudostate newElement = UMLFactory.eINSTANCE.createPseudostate();
-
- Region owner = (Region)getElementToEdit();
- owner.getSubvertices().add(newElement);
-
- ElementInitializers.getInstance().init_Pseudostate_9000(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest)getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- protected EObject getElementToEdit() {
-
- EObject container = ((CreateElementRequest)getRequest()).getContainer();
- if(container instanceof View) {
- container = ((View)container).getElement();
- }
- if(container != null) {
- return container;
- }
- return eObject;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateJunctionCreateCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateJunctionCreateCommand.java
deleted file mode 100644
index 9663a5f98b8..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateJunctionCreateCommand.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.papyrus.diagram.statemachine.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Pseudostate;
-import org.eclipse.uml2.uml.Region;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class PseudostateJunctionCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- public static PseudostateJunctionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PseudostateJunctionCreateCommand(req, eObject);
- }
-
- /**
- * @generated
- */
- private EClass eClass = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public PseudostateJunctionCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-
- /**
- * @generated
- */
- public PseudostateJunctionCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
- }
-
- /**
- * @generated
- */
- public boolean canExecute() {
-
- return true;
-
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Pseudostate newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if(configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-
- /**
- * @generated
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Pseudostate newElement = UMLFactory.eINSTANCE.createPseudostate();
-
- Region owner = (Region)getElementToEdit();
- owner.getSubvertices().add(newElement);
-
- ElementInitializers.getInstance().init_Pseudostate_12000(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest)getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- protected EObject getElementToEdit() {
-
- EObject container = ((CreateElementRequest)getRequest()).getContainer();
- if(container instanceof View) {
- container = ((View)container).getElement();
- }
- if(container != null) {
- return container;
- }
- return eObject;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateShallowHistoryCreateCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateShallowHistoryCreateCommand.java
deleted file mode 100644
index f6f05e2f391..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateShallowHistoryCreateCommand.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.papyrus.diagram.statemachine.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Pseudostate;
-import org.eclipse.uml2.uml.Region;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class PseudostateShallowHistoryCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- public static PseudostateShallowHistoryCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PseudostateShallowHistoryCreateCommand(req, eObject);
- }
-
- /**
- * @generated
- */
- private EClass eClass = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public PseudostateShallowHistoryCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-
- /**
- * @generated
- */
- public PseudostateShallowHistoryCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
- }
-
- /**
- * @generated
- */
- public boolean canExecute() {
-
- return true;
-
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Pseudostate newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if(configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-
- /**
- * @generated
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Pseudostate newElement = UMLFactory.eINSTANCE.createPseudostate();
-
- Region owner = (Region)getElementToEdit();
- owner.getSubvertices().add(newElement);
-
- ElementInitializers.getInstance().init_Pseudostate_13000(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest)getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- protected EObject getElementToEdit() {
-
- EObject container = ((CreateElementRequest)getRequest()).getContainer();
- if(container instanceof View) {
- container = ((View)container).getElement();
- }
- if(container != null) {
- return container;
- }
- return eObject;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateTerminateCreateCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateTerminateCreateCommand.java
deleted file mode 100644
index 8acbfd56fff..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/PseudostateTerminateCreateCommand.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.papyrus.diagram.statemachine.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Pseudostate;
-import org.eclipse.uml2.uml.Region;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class PseudostateTerminateCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- public static PseudostateTerminateCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PseudostateTerminateCreateCommand(req, eObject);
- }
-
- /**
- * @generated
- */
- private EClass eClass = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public PseudostateTerminateCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-
- /**
- * @generated
- */
- public PseudostateTerminateCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
- }
-
- /**
- * @generated
- */
- public boolean canExecute() {
-
- return true;
-
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Pseudostate newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if(configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-
- /**
- * @generated
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Pseudostate newElement = UMLFactory.eINSTANCE.createPseudostate();
-
- Region owner = (Region)getElementToEdit();
- owner.getSubvertices().add(newElement);
-
- ElementInitializers.getInstance().init_Pseudostate_15000(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest)getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- protected EObject getElementToEdit() {
-
- EObject container = ((CreateElementRequest)getRequest()).getContainer();
- if(container instanceof View) {
- container = ((View)container).getElement();
- }
- if(container != null) {
- return container;
- }
- return eObject;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/RegionCreateCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/RegionCreateCommand.java
deleted file mode 100644
index 9bfb46579c6..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/RegionCreateCommand.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.papyrus.diagram.statemachine.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Region;
-import org.eclipse.uml2.uml.StateMachine;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class RegionCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- public static RegionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new RegionCreateCommand(req, eObject);
- }
-
- /**
- * @generated
- */
- private EClass eClass = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public RegionCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-
- /**
- * @generated
- */
- public RegionCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
- }
-
- /**
- * @generated
- */
- public boolean canExecute() {
-
- return true;
-
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Region newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if(configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-
- /**
- * @generated
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Region newElement = UMLFactory.eINSTANCE.createRegion();
-
- StateMachine owner = (StateMachine)getElementToEdit();
- owner.getRegions().add(newElement);
-
- ElementInitializers.getInstance().init_Region_3000(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest)getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- protected EObject getElementToEdit() {
-
- EObject container = ((CreateElementRequest)getRequest()).getContainer();
- if(container instanceof View) {
- container = ((View)container).getElement();
- }
- if(container != null) {
- return container;
- }
- return eObject;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/StateCreateCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/StateCreateCommand.java
deleted file mode 100644
index febbf01a83c..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/StateCreateCommand.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.papyrus.diagram.statemachine.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Region;
-import org.eclipse.uml2.uml.State;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class StateCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- public static StateCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new StateCreateCommand(req, eObject);
- }
-
- /**
- * @generated
- */
- private EClass eClass = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public StateCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-
- /**
- * @generated
- */
- public StateCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
- }
-
- /**
- * @generated
- */
- public boolean canExecute() {
-
- return true;
-
- }
-
- /**
- * @generated
- */
- protected void doConfigure(State newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if(configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-
- /**
- * @generated
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- State newElement = UMLFactory.eINSTANCE.createState();
-
- Region owner = (Region)getElementToEdit();
- owner.getSubvertices().add(newElement);
-
- ElementInitializers.getInstance().init_State_6000(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest)getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- protected EObject getElementToEdit() {
-
- EObject container = ((CreateElementRequest)getRequest()).getContainer();
- if(container instanceof View) {
- container = ((View)container).getElement();
- }
- if(container != null) {
- return container;
- }
- return eObject;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/StateMachineCreateCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/StateMachineCreateCommand.java
deleted file mode 100644
index 38341117720..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/StateMachineCreateCommand.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.papyrus.diagram.statemachine.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.StateMachine;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class StateMachineCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- public static StateMachineCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new StateMachineCreateCommand(req, eObject);
- }
-
- /**
- * @generated
- */
- private EClass eClass = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public StateMachineCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-
- /**
- * @generated
- */
- public StateMachineCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
- }
-
- /**
- * @generated
- */
- public boolean canExecute() {
-
- return true;
-
- }
-
- /**
- * @generated
- */
- protected void doConfigure(StateMachine newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if(configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-
- /**
- * @generated
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- StateMachine newElement = UMLFactory.eINSTANCE.createStateMachine();
-
- Package owner = (Package)getElementToEdit();
- owner.getPackagedElements().add(newElement);
-
- ElementInitializers.getInstance().init_StateMachine_2000(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest)getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- protected EObject getElementToEdit() {
-
- EObject container = ((CreateElementRequest)getRequest()).getContainer();
- if(container instanceof View) {
- container = ((View)container).getElement();
- }
- if(container != null) {
- return container;
- }
- return eObject;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/TransitionCreateCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/TransitionCreateCommand.java
deleted file mode 100644
index fdad3010251..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/TransitionCreateCommand.java
+++ /dev/null
@@ -1,155 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.diagram.statemachine.edit.policies.UMLBaseItemSemanticEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Region;
-import org.eclipse.uml2.uml.Transition;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.Vertex;
-
-/**
- * @generated
- */
-public class TransitionCreateCommand extends EditElementCommand {
-
- /**
- * Default approach is to traverse ancestors of the source to find instance
- * of container. Modify with appropriate logic.
- *
- * @generated
- */
- protected Region deduceContainer(EObject source, 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 Region) {
- return (Region)element;
- }
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected final EObject source;
-
- /**
- * @generated
- */
- protected final EObject target;
-
- /**
- * @generated
- */
- protected Region container;
-
- /**
- * @generated
- */
- public TransitionCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
- super(request.getLabel(), null, request);
- this.source = source;
- this.target = target;
- container = deduceContainer(source, target);
- }
-
- /**
- * @generated
- */
- public boolean canExecute() {
- if(source == null && target == null) {
- return false;
- }
- if(source != null && false == source instanceof Vertex) {
- return false;
- }
- if(target != null && false == target instanceof Vertex) {
- 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().canCreateTransition_7000(getContainer(), getSource(), getTarget());
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Transition newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- configureRequest.setParameter(CreateRelationshipRequest.SOURCE, getSource());
- configureRequest.setParameter(CreateRelationshipRequest.TARGET, getTarget());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if(configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-
- /**
- * @generated
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- if(!canExecute()) {
- throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
- }
-
- Transition newElement = UMLFactory.eINSTANCE.createTransition();
- getContainer().getTransitions().add(newElement);
- newElement.setSource(getSource());
- newElement.setTarget(getTarget());
- ElementInitializers.getInstance().init_Transition_7000(newElement);
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest)getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
-
- }
-
- /**
- * @generated
- */
- public Region getContainer() {
- return container;
- }
-
- /**
- * @generated
- */
- protected Vertex getSource() {
- return (Vertex)source;
- }
-
- /**
- * @generated
- */
- protected Vertex getTarget() {
- return (Vertex)target;
- }
-
- /**
- * @generated
- */
- protected void setElementToEdit(EObject element) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/TransitionReorientCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/TransitionReorientCommand.java
deleted file mode 100644
index c258b72138e..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/TransitionReorientCommand.java
+++ /dev/null
@@ -1,157 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.papyrus.diagram.statemachine.edit.policies.UMLBaseItemSemanticEditPolicy;
-import org.eclipse.uml2.uml.Region;
-import org.eclipse.uml2.uml.Transition;
-import org.eclipse.uml2.uml.Vertex;
-
-/**
- * @generated
- */
-public class TransitionReorientCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private final int reorientDirection;
-
- /**
- * @generated
- */
- private final EObject oldEnd;
-
- /**
- * @generated
- */
- private final EObject newEnd;
-
- /**
- * @generated
- */
- public TransitionReorientCommand(ReorientRelationshipRequest request) {
- super(request.getLabel(), request.getRelationship(), request);
- reorientDirection = request.getDirection();
- oldEnd = request.getOldRelationshipEnd();
- newEnd = request.getNewRelationshipEnd();
- }
-
- /**
- * @generated
- */
- public boolean canExecute() {
- if(false == getElementToEdit() instanceof Transition) {
- return false;
- }
- if(reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
- return canReorientSource();
- }
- if(reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
- return canReorientTarget();
- }
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean canReorientSource() {
- if(!(oldEnd instanceof Vertex && newEnd instanceof Vertex)) {
- return false;
- }
- Vertex target = getLink().getTarget();
- if(!(getLink().eContainer() instanceof Region)) {
- return false;
- }
- Region container = (Region)getLink().eContainer();
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistTransition_7000(container, getLink(), getNewSource(), target);
- }
-
- /**
- * @generated
- */
- protected boolean canReorientTarget() {
- if(!(oldEnd instanceof Vertex && newEnd instanceof Vertex)) {
- return false;
- }
- Vertex source = getLink().getSource();
- if(!(getLink().eContainer() instanceof Region)) {
- return false;
- }
- Region container = (Region)getLink().eContainer();
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistTransition_7000(container, getLink(), source, getNewTarget());
- }
-
- /**
- * @generated
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- if(!canExecute()) {
- throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
- }
- if(reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
- return reorientSource();
- }
- if(reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
- return reorientTarget();
- }
- throw new IllegalStateException();
- }
-
- /**
- * @generated
- */
- protected Transition getLink() {
- return (Transition)getElementToEdit();
- }
-
- /**
- * @generated
- */
- protected Vertex getNewSource() {
- return (Vertex)newEnd;
- }
-
- /**
- * @generated
- */
- protected Vertex getNewTarget() {
- return (Vertex)newEnd;
- }
-
- /**
- * @generated
- */
- protected Vertex getOldSource() {
- return (Vertex)oldEnd;
- }
-
- /**
- * @generated
- */
- protected Vertex getOldTarget() {
- return (Vertex)oldEnd;
- }
-
- /**
- * @generated
- */
- protected CommandResult reorientSource() throws ExecutionException {
- getLink().setSource(getNewSource());
- return CommandResult.newOKCommandResult(getLink());
- }
-
- /**
- * @generated
- */
- protected CommandResult reorientTarget() throws ExecutionException {
- getLink().setTarget(getNewTarget());
- return CommandResult.newOKCommandResult(getLink());
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/UMLReorientConnectionViewCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/UMLReorientConnectionViewCommand.java
deleted file mode 100644
index 79c6d6e29a5..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/commands/UMLReorientConnectionViewCommand.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.commands;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.View;
-
-/**
- * @generated
- */
-public class UMLReorientConnectionViewCommand extends AbstractTransactionalCommand {
-
- /**
- * @generated
- */
- private IAdaptable edgeAdaptor;
-
- /**
- * @generated
- */
- public UMLReorientConnectionViewCommand(TransactionalEditingDomain editingDomain, String label) {
- super(editingDomain, label, null);
- }
-
- /**
- * @generated
- */
- protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) {
- assert null != edgeAdaptor : "Null child in UMLReorientConnectionViewCommand"; //$NON-NLS-1$
- Edge edge = (Edge)getEdgeAdaptor().getAdapter(Edge.class);
- assert null != edge : "Null edge in UMLReorientConnectionViewCommand"; //$NON-NLS-1$
- View tempView = edge.getSource();
- edge.setSource(edge.getTarget());
- edge.setTarget(tempView);
- return CommandResult.newOKCommandResult();
- }
-
- /**
- * @generated
- */
- public List getAffectedFiles() {
- View view = (View)edgeAdaptor.getAdapter(View.class);
- if(view != null) {
- return getWorkspaceFiles(view);
- }
- return super.getAffectedFiles();
- }
-
- /**
- * @generated
- */
- public IAdaptable getEdgeAdaptor() {
- return edgeAdaptor;
- }
-
- /**
- * @generated
- */
- public void setEdgeAdaptor(IAdaptable edgeAdaptor) {
- this.edgeAdaptor = edgeAdaptor;
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/ConnectionPointReferenceEditHelper.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/ConnectionPointReferenceEditHelper.java
deleted file mode 100644
index 55b185a9170..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/ConnectionPointReferenceEditHelper.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.helpers;
-
-/**
- * @generated
- */
-public class ConnectionPointReferenceEditHelper extends UMLBaseEditHelper {
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/FinalStateEditHelper.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/FinalStateEditHelper.java
deleted file mode 100644
index 7ed702aa4c9..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/FinalStateEditHelper.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.helpers;
-
-/**
- * @generated
- */
-public class FinalStateEditHelper extends UMLBaseEditHelper {
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/GeneralizationEditHelper.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/GeneralizationEditHelper.java
deleted file mode 100644
index ff2ca7e56e4..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/GeneralizationEditHelper.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.helpers;
-
-/**
- * @generated
- */
-public class GeneralizationEditHelper extends UMLBaseEditHelper {
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/PackageEditHelper.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/PackageEditHelper.java
deleted file mode 100644
index 4b9f1bf9f35..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/PackageEditHelper.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.helpers;
-
-/**
- * @generated
- */
-public class PackageEditHelper extends UMLBaseEditHelper {
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/PseudostateEditHelper.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/PseudostateEditHelper.java
deleted file mode 100644
index 14949cf0be7..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/PseudostateEditHelper.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.helpers;
-
-/**
- * @generated
- */
-public class PseudostateEditHelper extends UMLBaseEditHelper {
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/RegionEditHelper.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/RegionEditHelper.java
deleted file mode 100644
index 2f152168879..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/RegionEditHelper.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.helpers;
-
-/**
- * @generated
- */
-public class RegionEditHelper extends UMLBaseEditHelper {
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/StateEditHelper.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/StateEditHelper.java
deleted file mode 100644
index 9194c89fdc2..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/StateEditHelper.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.helpers;
-
-/**
- * @generated
- */
-public class StateEditHelper extends UMLBaseEditHelper {
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/StateMachineEditHelper.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/StateMachineEditHelper.java
deleted file mode 100644
index 16157895e66..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/StateMachineEditHelper.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.helpers;
-
-/**
- * @generated
- */
-public class StateMachineEditHelper extends UMLBaseEditHelper {
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/TransitionEditHelper.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/TransitionEditHelper.java
deleted file mode 100644
index 6a406c5d168..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/TransitionEditHelper.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.helpers;
-
-/**
- * @generated
- */
-public class TransitionEditHelper extends UMLBaseEditHelper {
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/UMLBaseEditHelper.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/UMLBaseEditHelper.java
deleted file mode 100644
index 36656d641c4..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/helpers/UMLBaseEditHelper.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.helpers;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelper;
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelperAdvice;
-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.IEditCommandRequest;
-import org.eclipse.papyrus.diagram.common.commands.UnapplyAllStereotypesCommand;
-import org.eclipse.uml2.uml.Element;
-
-/**
- * @generated
- */
-public class UMLBaseEditHelper extends AbstractEditHelper {
-
- /**
- * @generated
- */
- public static final String EDIT_POLICY_COMMAND = "edit policy command"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final String CONTEXT_ELEMENT_TYPE = "context element type"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- protected ICommand getCreateCommand(CreateElementRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected ICommand getCreateRelationshipCommand(CreateRelationshipRequest req) {
- return null;
- }
-
- /**
- * @generated NOT handle unapply stereotypes before delete
- */
- protected ICommand getDestroyElementCommand(DestroyElementRequest req) {
- EObject elementToDestroy = req.getElementToDestroy();
- if(elementToDestroy instanceof Element) {
- UnapplyAllStereotypesCommand command = new UnapplyAllStereotypesCommand(req.getEditingDomain(), req.getLabel(), (Element)elementToDestroy);
- if(!command.isEmpty()) {
- return command;
- }
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected ICommand getDestroyReferenceCommand(DestroyReferenceRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected IEditHelperAdvice[] getEditHelperAdvice(IEditCommandRequest req) {
- if(req.getParameter(CONTEXT_ELEMENT_TYPE) instanceof IElementType) {
- return ElementTypeRegistry.getInstance().getEditHelperAdvice((IElementType)req.getParameter(CONTEXT_ELEMENT_TYPE));
- }
- return super.getEditHelperAdvice(req);
- }
-
- /**
- * @generated
- */
- protected ICommand getInsteadCommand(IEditCommandRequest req) {
- ICommand epCommand = (ICommand)req.getParameter(EDIT_POLICY_COMMAND);
- req.setParameter(EDIT_POLICY_COMMAND, null);
- ICommand ehCommand = super.getInsteadCommand(req);
- if(epCommand == null) {
- return ehCommand;
- }
- if(ehCommand == null) {
- return epCommand;
- }
- CompositeCommand command = new CompositeCommand(null);
- command.add(epCommand);
- command.add(ehCommand);
- return command;
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/ConnectionPointReferenceEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/ConnectionPointReferenceEditPart.java
deleted file mode 100644
index 65052525a8b..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/ConnectionPointReferenceEditPart.java
+++ /dev/null
@@ -1,406 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.papyrus.diagram.common.editparts.AbstractBorderEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.papyrus.diagram.common.locator.ExternalLabelPositionLocator;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.ConnectionPointReferenceFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.ConnectionPointReferenceItemSemanticEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class ConnectionPointReferenceEditPart extends
-
-AbstractBorderEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 18000;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public ConnectionPointReferenceEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
- if(borderItemEditPart instanceof ConnectionPointReferenceStereotypeEditPart) {
- BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH);
- locator.setBorderItemOffset(new Dimension(-20, -20));
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else if(borderItemEditPart instanceof ConnectionPointReferenceNameEditPart) {
- IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else {
- super.addBorderItem(borderItemContainer, borderItemEditPart);
- }
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy());
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ConnectionPointReferenceItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- // 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() {
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
-
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View)child.getModel();
- switch(UMLVisualIDRegistry.getVisualID(childView)) {
- case ConnectionPointReferenceNameEditPart.VISUAL_ID:
- case ConnectionPointReferenceStereotypeEditPart.VISUAL_ID:
- return new BorderItemSelectionEditPolicy() {
-
- protected List createSelectionHandles() {
- 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;
- }
-
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * 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
- */
- protected NodeFigure createMainFigure() {
- NodeFigure figure = createNodePlate();
- figure.setLayoutManager(new StackLayout());
- IFigure shape = createNodeShape();
- figure.add(shape);
- contentPane = setupContentPane(shape);
- return figure;
- }
-
- /**
- * @generated
- */
- protected NodeFigure createNodePlate() {
- String prefElementId = "ConnectionPointReference";
- IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
- String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
- String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
- DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
-
- //FIXME: workaround for #154536
- result.getBounds().setSize(result.getPreferredSize());
- return result;
- }
-
- /**
- * @generated
- */
- protected IFigure createNodeShape() {
- return primaryShape = new ConnectionPointReferenceFigure();
- }
-
- /**
- * @generated
- */
- public IFigure getContentPane() {
- if(contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSource() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSourceAndTarget(IGraphicalEditPart targetEditPart) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(targetEditPart instanceof FinalStateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof StateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateInitialEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateJoinEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateForkEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateChoiceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateJunctionEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateShallowHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateDeepHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateTerminateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateEntryPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateExitPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof org.eclipse.papyrus.diagram.statemachine.edit.parts.ConnectionPointReferenceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnTarget() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForSource(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForTarget(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- @Override
- public Object getPreferredValue(EStructuralFeature feature) {
- 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("ConnectionPointReference", PreferenceConstantHelper.COLOR_LINE);
- } else if(feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("ConnectionPointReference", PreferenceConstantHelper.COLOR_FONT);
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("ConnectionPointReference", PreferenceConstantHelper.COLOR_FILL);
- }
- result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor((IPreferenceStore)preferenceStore, prefColor));
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
- String prefGradient = PreferenceConstantHelper.getElementConstant("ConnectionPointReference", PreferenceConstantHelper.COLOR_GRADIENT);
- 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;
- }
-
- /**
- * @generated
- */
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(ConnectionPointReferenceNameEditPart.VISUAL_ID));
- }
-
- /**
- * @generated
- */
- public ConnectionPointReferenceFigure getPrimaryShape() {
- return (ConnectionPointReferenceFigure)primaryShape;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- protected void setForegroundColor(Color color) {
- if(primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineType(int style) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineWidth(int width) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineWidth(width);
- }
- }
-
- /**
- * 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(IFigure nodeShape) {
- return nodeShape; // use nodeShape itself as contentPane
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/ConnectionPointReferenceNameEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/ConnectionPointReferenceNameEditPart.java
deleted file mode 100644
index 2ade04e8cba..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/ConnectionPointReferenceNameEditPart.java
+++ /dev/null
@@ -1,746 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class ConnectionPointReferenceNameEditPart
-
-extends LabelEditPart
-
-implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 18001;
-
- /**
- * @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.diagram.statemachine.edit.parts.ConnectionPointReferenceNameEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public ConnectionPointReferenceNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- }
-
- /**
- * @generated
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new WrappingLabel();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.ConnectionPointReference_18000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.ConnectionPointReferenceNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/ConnectionPointReferenceStereotypeEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/ConnectionPointReferenceStereotypeEditPart.java
deleted file mode 100644
index fae0281b7ef..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/ConnectionPointReferenceStereotypeEditPart.java
+++ /dev/null
@@ -1,750 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editparts.AbstractLabelEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class ConnectionPointReferenceStereotypeEditPart
-
-extends AbstractLabelEditPart
-
-implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 18002;
-
- /**
- * @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.diagram.statemachine.edit.parts.ConnectionPointReferenceStereotypeEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public ConnectionPointReferenceStereotypeEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- 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
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new AppliedStereotypeWrappingLabelFigure();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.ConnectionPointReference_18000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.ConnectionPointReferenceStereotypeEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/FinalStateEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/FinalStateEditPart.java
deleted file mode 100644
index d2e7f02736d..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/FinalStateEditPart.java
+++ /dev/null
@@ -1,396 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.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.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.diagram.common.editparts.UMLNodeEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.papyrus.diagram.common.locator.ExternalLabelPositionLocator;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.FinalStateFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.FinalStateItemSemanticEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class FinalStateEditPart extends
-
-UMLNodeEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 5000;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public FinalStateEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
- if(borderItemEditPart instanceof FinalStateNameEditPart) {
- IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else if(borderItemEditPart instanceof FinalStateStereotypeEditPart) {
- IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else {
- super.addBorderItem(borderItemContainer, borderItemEditPart);
- }
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new FinalStateItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- // 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() {
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
-
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View)child.getModel();
- switch(UMLVisualIDRegistry.getVisualID(childView)) {
- case FinalStateNameEditPart.VISUAL_ID:
- case FinalStateStereotypeEditPart.VISUAL_ID:
- return new BorderItemSelectionEditPolicy() {
-
- protected List createSelectionHandles() {
- 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;
- }
-
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * 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
- */
- protected NodeFigure createMainFigure() {
- NodeFigure figure = createNodePlate();
- figure.setLayoutManager(new StackLayout());
- IFigure shape = createNodeShape();
- figure.add(shape);
- contentPane = setupContentPane(shape);
- return figure;
- }
-
- /**
- * @generated
- */
- protected NodeFigure createNodePlate() {
- String prefElementId = "FinalState";
- IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
- String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
- String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
- DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
-
- return result;
- }
-
- /**
- * @generated
- */
- protected IFigure createNodeShape() {
- return primaryShape = new FinalStateFigure();
- }
-
- /**
- * @generated
- */
- public IFigure getContentPane() {
- if(contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSource() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSourceAndTarget(IGraphicalEditPart targetEditPart) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(targetEditPart instanceof org.eclipse.papyrus.diagram.statemachine.edit.parts.FinalStateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof StateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateInitialEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateJoinEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateForkEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateChoiceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateJunctionEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateShallowHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateDeepHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateTerminateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateEntryPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateExitPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof ConnectionPointReferenceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnTarget() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForSource(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForTarget(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- @Override
- public Object getPreferredValue(EStructuralFeature feature) {
- 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("FinalState", PreferenceConstantHelper.COLOR_LINE);
- } else if(feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("FinalState", PreferenceConstantHelper.COLOR_FONT);
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("FinalState", PreferenceConstantHelper.COLOR_FILL);
- }
- result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor((IPreferenceStore)preferenceStore, prefColor));
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
- String prefGradient = PreferenceConstantHelper.getElementConstant("FinalState", PreferenceConstantHelper.COLOR_GRADIENT);
- 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;
- }
-
- /**
- * @generated
- */
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(FinalStateNameEditPart.VISUAL_ID));
- }
-
- /**
- * @generated
- */
- public FinalStateFigure getPrimaryShape() {
- return (FinalStateFigure)primaryShape;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- protected void setForegroundColor(Color color) {
- if(primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineType(int style) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineWidth(int width) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineWidth(width);
- }
- }
-
- /**
- * 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(IFigure nodeShape) {
- return nodeShape; // use nodeShape itself as contentPane
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/FinalStateNameEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/FinalStateNameEditPart.java
deleted file mode 100644
index 27affe88c17..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/FinalStateNameEditPart.java
+++ /dev/null
@@ -1,747 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class FinalStateNameEditPart
-
-extends LabelEditPart
-
-implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 5001;
-
- /**
- * @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.diagram.statemachine.edit.parts.FinalStateNameEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public FinalStateNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- }
-
- /**
- * @generated
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new WrappingLabel();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.FinalState_5000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.FinalStateNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/FinalStateStereotypeEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/FinalStateStereotypeEditPart.java
deleted file mode 100644
index d38d466bce0..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/FinalStateStereotypeEditPart.java
+++ /dev/null
@@ -1,751 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editparts.AbstractLabelEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class FinalStateStereotypeEditPart
-
-extends AbstractLabelEditPart
-
-implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 5002;
-
- /**
- * @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.diagram.statemachine.edit.parts.FinalStateStereotypeEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public FinalStateStereotypeEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- 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
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new AppliedStereotypeWrappingLabelFigure();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.FinalState_5000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.FinalStateStereotypeEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/GeneralizationEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/GeneralizationEditPart.java
deleted file mode 100644
index 1e13398f36e..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/GeneralizationEditPart.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.diagram.common.editparts.UMLConnectionNodeEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.edge.GeneralizationFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.GeneralizationItemSemanticEditPolicy;
-
-/**
- * @generated
- */
-public class GeneralizationEditPart extends
-
-UMLConnectionNodeEditPart implements ITreeBranchEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 19000;
-
- /**
- * @generated
- */
- public GeneralizationEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addChildVisual(EditPart childEditPart, int index) {
- if(addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if(childEditPart instanceof GeneralizationStereotypeEditPart) {
- ((GeneralizationStereotypeEditPart)childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
- return true;
- }
- return false;
- }
-
- /**
- * 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
- */
- protected Connection createConnectionFigure() {
- return new GeneralizationFigure();
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new GeneralizationItemSemanticEditPolicy());
- installEditPolicy(AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy());
- }
-
- /**
- * @generated
- */
- public GeneralizationFigure getPrimaryShape() {
- return (GeneralizationFigure)getFigure();
- }
-
- /**
- * @generated
- */
- protected void removeChildVisual(EditPart childEditPart) {
- if(removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if(childEditPart instanceof GeneralizationStereotypeEditPart) {
- return true;
- }
- return false;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/GeneralizationStereotypeEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/GeneralizationStereotypeEditPart.java
deleted file mode 100644
index 72221a5347c..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/GeneralizationStereotypeEditPart.java
+++ /dev/null
@@ -1,710 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.editparts.LabelEditPart;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class GeneralizationStereotypeEditPart extends LabelEditPart implements ITextAwareEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 19002;
-
- /**
- * @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.diagram.statemachine.edit.parts.GeneralizationStereotypeEditPart.VISUAL_ID), new Point(0, 40));
- }
-
- /**
- * @generated
- */
- public GeneralizationStereotypeEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- 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 PackageEditPart.LinkLabelDragPolicy());
- }
-
- /**
- * @generated
- */
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- // The label is read-only (defined in GMFGen model)
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- public int getKeyPoint() {
- return ConnectionLocator.MIDDLE;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Generalization_19000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.GeneralizationStereotypeEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
-
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return false;
- }
-
- /**
- * 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(WrappingLabel figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PackageEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PackageEditPart.java
deleted file mode 100644
index 73f750f301b..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PackageEditPart.java
+++ /dev/null
@@ -1,190 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IClippingStrategy;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAnnotation;
-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.NonResizableEditPolicy;
-import org.eclipse.gef.handles.MoveHandle;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableLabelEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.BorderedNodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.common.editpolicies.DuplicatePasteEditPolicy;
-import org.eclipse.papyrus.diagram.common.providers.ViewInfo;
-import org.eclipse.papyrus.diagram.common.util.MDTUtil;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomPackageCreationEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomPackageXYLayoutEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateMachineDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.RemoveOrphanViewPolicy;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.PackageItemSemanticEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-
-/**
- * @generated
- */
-public class PackageEditPart extends DiagramEditPart {
-
- /**
- * @generated
- */
- /* package-local */static class LinkLabelDragPolicy extends NonResizableLabelEditPolicy {
-
- /**
- * @generated
- */
- @SuppressWarnings("rawtypes")
- protected List createSelectionHandles() {
- MoveHandle mh = new MoveHandle((GraphicalEditPart)getHost());
- mh.setBorder(null);
- return Collections.singletonList(mh);
- }
- }
-
- /**
- * @generated
- */
- /* package-local */static class NodeLabelDragPolicy extends NonResizableEditPolicy {
-
- /**
- * @generated
- */
- @SuppressWarnings("rawtypes")
- protected List createSelectionHandles() {
- MoveHandle h = new MoveHandle((GraphicalEditPart)getHost());
- h.setBorder(null);
- return Collections.singletonList(h);
- }
-
- /**
- * @generated
- */
- public Command getCommand(Request request) {
- return null;
- }
-
- /**
- * @generated
- */
- public boolean understandsRequest(Request request) {
- return false;
- }
- }
-
- /**
- * @generated
- */
- public final static String MODEL_ID = "PapyrusUMLStateMachineDiagram"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 1000;
-
- /**
- * @generated
- */
- public PackageEditPart(View view) {
- super(view);
-
- getFigure().setClippingStrategy(new IClippingStrategy() {
-
- public Rectangle[] getClip(IFigure childFigure) {
- // very inefficient, since it implies several tree traversals. Bit handles modifications of the tree structure
- // It's a workaround instead of the better solution to fix BorderedNodeFigure (overload and let it return
- // getExtendedBounds)
- // See bug 313985 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=313985) for more details
- applyClippingStrategy(childFigure);
- if(childFigure instanceof BorderedNodeFigure) {
- return new Rectangle[]{ ((BorderedNodeFigure)childFigure).getExtendedBounds() };
-
- } else {
- return new Rectangle[]{ childFigure.getBounds() };
- }
- }
- });
- }
-
- /**
- * @generated
- */
- public void applyClippingStrategy(IFigure fig) {
- boolean hasBorderedNodeChild = false;
- for(Object child : fig.getChildren()) {
- if(child instanceof IFigure) {
- applyClippingStrategy((IFigure)child);
- if(child instanceof BorderedNodeFigure) {
- hasBorderedNodeChild = true;
- }
- }
- }
- if(hasBorderedNodeChild && (fig.getClippingStrategy() == null)) {
- fig.setClippingStrategy(new IClippingStrategy() {
-
- public Rectangle[] getClip(IFigure childFigure) {
- if(childFigure instanceof BorderedNodeFigure) {
- return new Rectangle[]{ ((BorderedNodeFigure)childFigure).getExtendedBounds() };
- } else {
- return new Rectangle[]{ childFigure.getBounds() };
- }
- }
- });
- }
-
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
-
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PackageItemSemanticEditPolicy());
-
- //in Papyrus diagrams are not strongly synchronised
- //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.diagram.statemachine.edit.policies.PackageCanonicalEditPolicy());
-
- installEditPolicy("RemoveOrphanView", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CustomPackageCreationEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, new CustomPackageXYLayoutEditPolicy());
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomStateMachineDiagramDragDropEditPolicy());
- // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE);
- }
-
- /**
- * @generated
- */
- public Object getAdapter(Class adapter) {
-
- if(adapter != null && adapter.equals(ViewInfo.class)) {
- return UMLVisualIDRegistry.getDiagramViewInfo();
- }
- return super.getAdapter(adapter);
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
-
- super.handleNotificationEvent(event);
- if(event.getNotifier() instanceof EAnnotation) {
- EAnnotation eAnnotation = (EAnnotation)event.getNotifier();
- if(eAnnotation.getSource() != null && eAnnotation.getSource().equals(MDTUtil.FilterViewAndLabelsSource)) {
- //modification form MOSKitt approach, canonical policies are not called
- MDTUtil.filterDiagramViews(this.getDiagramView());
- }
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateChoiceEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateChoiceEditPart.java
deleted file mode 100644
index 2069258c930..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateChoiceEditPart.java
+++ /dev/null
@@ -1,399 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.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.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.diagram.common.editparts.UMLNodeEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.papyrus.diagram.common.locator.ExternalLabelPositionLocator;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.PseudostateChoiceFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.PseudostateChoiceItemSemanticEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class PseudostateChoiceEditPart extends
-
-UMLNodeEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 11000;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public PseudostateChoiceEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
- if(borderItemEditPart instanceof PseudostateChoiceNameEditPart) {
- IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else if(borderItemEditPart instanceof PseudostateChoiceStereotypeEditPart) {
- IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else {
- super.addBorderItem(borderItemContainer, borderItemEditPart);
- }
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PseudostateChoiceItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- // 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() {
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
-
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View)child.getModel();
- switch(UMLVisualIDRegistry.getVisualID(childView)) {
- case PseudostateChoiceNameEditPart.VISUAL_ID:
- case PseudostateChoiceStereotypeEditPart.VISUAL_ID:
- return new BorderItemSelectionEditPolicy() {
-
- protected List createSelectionHandles() {
- 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;
- }
-
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * 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
- */
- protected NodeFigure createMainFigure() {
- NodeFigure figure = createNodePlate();
- figure.setLayoutManager(new StackLayout());
- IFigure shape = createNodeShape();
- figure.add(shape);
- contentPane = setupContentPane(shape);
- return figure;
- }
-
- /**
- * @generated
- */
- protected NodeFigure createNodePlate() {
- String prefElementId = "Pseudostate";
- IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
- String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
- String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
- DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
-
- return result;
- }
-
- /**
- * @generated
- */
- protected IFigure createNodeShape() {
- return primaryShape = new PseudostateChoiceFigure();
- }
-
- /**
- * @generated
- */
- public IFigure getContentPane() {
- if(contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSource() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSourceAndTarget(IGraphicalEditPart targetEditPart) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(targetEditPart instanceof FinalStateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof StateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateInitialEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateJoinEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateForkEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateChoiceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateJunctionEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateShallowHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateDeepHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateTerminateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateEntryPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateExitPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof ConnectionPointReferenceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnTarget() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForSource(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForTarget(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- @Override
- public Object getPreferredValue(EStructuralFeature feature) {
- 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("Pseudostate", PreferenceConstantHelper.COLOR_LINE);
- } else if(feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_FONT);
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_FILL);
- }
- result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor((IPreferenceStore)preferenceStore, prefColor));
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
- String prefGradient = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_GRADIENT);
- 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;
- }
-
- /**
- * @generated
- */
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(PseudostateChoiceNameEditPart.VISUAL_ID));
- }
-
- /**
- * @generated
- */
- public PseudostateChoiceFigure getPrimaryShape() {
- return (PseudostateChoiceFigure)primaryShape;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- protected void setForegroundColor(Color color) {
- if(primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineType(int style) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineWidth(int width) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineWidth(width);
- }
- }
-
- /**
- * 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(IFigure nodeShape) {
- return nodeShape; // use nodeShape itself as contentPane
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateChoiceNameEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateChoiceNameEditPart.java
deleted file mode 100644
index f56ccbeafe9..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateChoiceNameEditPart.java
+++ /dev/null
@@ -1,746 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class PseudostateChoiceNameEditPart
-
-extends LabelEditPart
-
-implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 11001;
-
- /**
- * @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.diagram.statemachine.edit.parts.PseudostateChoiceNameEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public PseudostateChoiceNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- }
-
- /**
- * @generated
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new WrappingLabel();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Pseudostate_11000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateChoiceNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateChoiceStereotypeEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateChoiceStereotypeEditPart.java
deleted file mode 100644
index fa468818ade..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateChoiceStereotypeEditPart.java
+++ /dev/null
@@ -1,750 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editparts.AbstractLabelEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class PseudostateChoiceStereotypeEditPart
-
-extends AbstractLabelEditPart
-
-implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 11002;
-
- /**
- * @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.diagram.statemachine.edit.parts.PseudostateChoiceStereotypeEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public PseudostateChoiceStereotypeEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- 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
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new AppliedStereotypeWrappingLabelFigure();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Pseudostate_11000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateChoiceStereotypeEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateDeepHistoryEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateDeepHistoryEditPart.java
deleted file mode 100644
index 1b253ebca33..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateDeepHistoryEditPart.java
+++ /dev/null
@@ -1,399 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.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.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.diagram.common.editparts.UMLNodeEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.papyrus.diagram.common.locator.ExternalLabelPositionLocator;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.PseudostateDeepHistoryFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.PseudostateDeepHistoryItemSemanticEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class PseudostateDeepHistoryEditPart extends
-
-UMLNodeEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 14000;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public PseudostateDeepHistoryEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
- if(borderItemEditPart instanceof PseudostateDeepHistoryNameEditPart) {
- IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else if(borderItemEditPart instanceof PseudostateDeepHistoryStereotypeEditPart) {
- IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else {
- super.addBorderItem(borderItemContainer, borderItemEditPart);
- }
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PseudostateDeepHistoryItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- // 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() {
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
-
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View)child.getModel();
- switch(UMLVisualIDRegistry.getVisualID(childView)) {
- case PseudostateDeepHistoryNameEditPart.VISUAL_ID:
- case PseudostateDeepHistoryStereotypeEditPart.VISUAL_ID:
- return new BorderItemSelectionEditPolicy() {
-
- protected List createSelectionHandles() {
- 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;
- }
-
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * 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
- */
- protected NodeFigure createMainFigure() {
- NodeFigure figure = createNodePlate();
- figure.setLayoutManager(new StackLayout());
- IFigure shape = createNodeShape();
- figure.add(shape);
- contentPane = setupContentPane(shape);
- return figure;
- }
-
- /**
- * @generated
- */
- protected NodeFigure createNodePlate() {
- String prefElementId = "Pseudostate";
- IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
- String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
- String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
- DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
-
- return result;
- }
-
- /**
- * @generated
- */
- protected IFigure createNodeShape() {
- return primaryShape = new PseudostateDeepHistoryFigure();
- }
-
- /**
- * @generated
- */
- public IFigure getContentPane() {
- if(contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSource() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSourceAndTarget(IGraphicalEditPart targetEditPart) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(targetEditPart instanceof FinalStateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof StateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateInitialEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateJoinEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateForkEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateChoiceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateJunctionEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateShallowHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateDeepHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateTerminateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateEntryPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateExitPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof ConnectionPointReferenceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnTarget() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForSource(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForTarget(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- @Override
- public Object getPreferredValue(EStructuralFeature feature) {
- 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("Pseudostate", PreferenceConstantHelper.COLOR_LINE);
- } else if(feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_FONT);
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_FILL);
- }
- result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor((IPreferenceStore)preferenceStore, prefColor));
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
- String prefGradient = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_GRADIENT);
- 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;
- }
-
- /**
- * @generated
- */
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(PseudostateDeepHistoryNameEditPart.VISUAL_ID));
- }
-
- /**
- * @generated
- */
- public PseudostateDeepHistoryFigure getPrimaryShape() {
- return (PseudostateDeepHistoryFigure)primaryShape;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- protected void setForegroundColor(Color color) {
- if(primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineType(int style) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineWidth(int width) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineWidth(width);
- }
- }
-
- /**
- * 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(IFigure nodeShape) {
- return nodeShape; // use nodeShape itself as contentPane
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateDeepHistoryNameEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateDeepHistoryNameEditPart.java
deleted file mode 100644
index a72209ca12e..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateDeepHistoryNameEditPart.java
+++ /dev/null
@@ -1,746 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class PseudostateDeepHistoryNameEditPart
-
-extends LabelEditPart
-
-implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 14001;
-
- /**
- * @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.diagram.statemachine.edit.parts.PseudostateDeepHistoryNameEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public PseudostateDeepHistoryNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- }
-
- /**
- * @generated
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new WrappingLabel();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Pseudostate_14000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateDeepHistoryNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateDeepHistoryStereotypeEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateDeepHistoryStereotypeEditPart.java
deleted file mode 100644
index b97520020f4..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateDeepHistoryStereotypeEditPart.java
+++ /dev/null
@@ -1,750 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editparts.AbstractLabelEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class PseudostateDeepHistoryStereotypeEditPart
-
-extends AbstractLabelEditPart
-
-implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 14002;
-
- /**
- * @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.diagram.statemachine.edit.parts.PseudostateDeepHistoryStereotypeEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public PseudostateDeepHistoryStereotypeEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- 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
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new AppliedStereotypeWrappingLabelFigure();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Pseudostate_14000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateDeepHistoryStereotypeEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateEntryPointEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateEntryPointEditPart.java
deleted file mode 100644
index f4f2a0ac8d7..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateEntryPointEditPart.java
+++ /dev/null
@@ -1,403 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.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.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.diagram.common.editparts.AbstractBorderEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.papyrus.diagram.common.locator.ExternalLabelPositionLocator;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.PseudostateEntryPointFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.PseudostateEntryPointItemSemanticEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class PseudostateEntryPointEditPart extends
-
-AbstractBorderEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 16000;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public PseudostateEntryPointEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
- if(borderItemEditPart instanceof PseudostateEntryPointNameEditPart) {
- IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else if(borderItemEditPart instanceof PseudostateEntryPointStereotypeEditPart) {
- IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else {
- super.addBorderItem(borderItemContainer, borderItemEditPart);
- }
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy());
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PseudostateEntryPointItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- // 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() {
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
-
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View)child.getModel();
- switch(UMLVisualIDRegistry.getVisualID(childView)) {
- case PseudostateEntryPointNameEditPart.VISUAL_ID:
- case PseudostateEntryPointStereotypeEditPart.VISUAL_ID:
- return new BorderItemSelectionEditPolicy() {
-
- protected List createSelectionHandles() {
- 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;
- }
-
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * 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
- */
- protected NodeFigure createMainFigure() {
- NodeFigure figure = createNodePlate();
- figure.setLayoutManager(new StackLayout());
- IFigure shape = createNodeShape();
- figure.add(shape);
- contentPane = setupContentPane(shape);
- return figure;
- }
-
- /**
- * @generated
- */
- protected NodeFigure createNodePlate() {
- String prefElementId = "Pseudostate";
- IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
- String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
- String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
- DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
-
- //FIXME: workaround for #154536
- result.getBounds().setSize(result.getPreferredSize());
- return result;
- }
-
- /**
- * @generated
- */
- protected IFigure createNodeShape() {
- return primaryShape = new PseudostateEntryPointFigure();
- }
-
- /**
- * @generated
- */
- public IFigure getContentPane() {
- if(contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSource() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSourceAndTarget(IGraphicalEditPart targetEditPart) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(targetEditPart instanceof FinalStateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof StateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateInitialEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateJoinEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateForkEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateChoiceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateJunctionEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateShallowHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateDeepHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateTerminateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateExitPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof ConnectionPointReferenceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnTarget() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForSource(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForTarget(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- @Override
- public Object getPreferredValue(EStructuralFeature feature) {
- 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("Pseudostate", PreferenceConstantHelper.COLOR_LINE);
- } else if(feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_FONT);
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_FILL);
- }
- result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor((IPreferenceStore)preferenceStore, prefColor));
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
- String prefGradient = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_GRADIENT);
- 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;
- }
-
- /**
- * @generated
- */
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(PseudostateEntryPointNameEditPart.VISUAL_ID));
- }
-
- /**
- * @generated
- */
- public PseudostateEntryPointFigure getPrimaryShape() {
- return (PseudostateEntryPointFigure)primaryShape;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- protected void setForegroundColor(Color color) {
- if(primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineType(int style) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineWidth(int width) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineWidth(width);
- }
- }
-
- /**
- * 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(IFigure nodeShape) {
- return nodeShape; // use nodeShape itself as contentPane
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateEntryPointNameEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateEntryPointNameEditPart.java
deleted file mode 100644
index 7632044035f..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateEntryPointNameEditPart.java
+++ /dev/null
@@ -1,746 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class PseudostateEntryPointNameEditPart
-
-extends LabelEditPart
-
-implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 16001;
-
- /**
- * @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.diagram.statemachine.edit.parts.PseudostateEntryPointNameEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public PseudostateEntryPointNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- }
-
- /**
- * @generated
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new WrappingLabel();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Pseudostate_16000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateEntryPointStereotypeEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateEntryPointStereotypeEditPart.java
deleted file mode 100644
index 870407cd2e6..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateEntryPointStereotypeEditPart.java
+++ /dev/null
@@ -1,750 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editparts.AbstractLabelEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class PseudostateEntryPointStereotypeEditPart
-
-extends AbstractLabelEditPart
-
-implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 16002;
-
- /**
- * @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.diagram.statemachine.edit.parts.PseudostateEntryPointStereotypeEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public PseudostateEntryPointStereotypeEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- 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
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new AppliedStereotypeWrappingLabelFigure();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Pseudostate_16000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointStereotypeEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateExitPointEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateExitPointEditPart.java
deleted file mode 100644
index 8c7919412e9..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateExitPointEditPart.java
+++ /dev/null
@@ -1,406 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.papyrus.diagram.common.editparts.AbstractBorderEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.papyrus.diagram.common.locator.ExternalLabelPositionLocator;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.PseudostateExitPointFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.PseudostateExitPointItemSemanticEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class PseudostateExitPointEditPart extends
-
-AbstractBorderEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 17000;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public PseudostateExitPointEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
- if(borderItemEditPart instanceof PseudostateExitPointStereotypeEditPart) {
- BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH);
- locator.setBorderItemOffset(new Dimension(-20, -20));
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else if(borderItemEditPart instanceof PseudostateExitPointNameEditPart) {
- IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else {
- super.addBorderItem(borderItemContainer, borderItemEditPart);
- }
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy());
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PseudostateExitPointItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- // 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() {
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
-
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View)child.getModel();
- switch(UMLVisualIDRegistry.getVisualID(childView)) {
- case PseudostateExitPointNameEditPart.VISUAL_ID:
- case PseudostateExitPointStereotypeEditPart.VISUAL_ID:
- return new BorderItemSelectionEditPolicy() {
-
- protected List createSelectionHandles() {
- 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;
- }
-
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * 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
- */
- protected NodeFigure createMainFigure() {
- NodeFigure figure = createNodePlate();
- figure.setLayoutManager(new StackLayout());
- IFigure shape = createNodeShape();
- figure.add(shape);
- contentPane = setupContentPane(shape);
- return figure;
- }
-
- /**
- * @generated
- */
- protected NodeFigure createNodePlate() {
- String prefElementId = "Pseudostate";
- IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
- String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
- String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
- DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
-
- //FIXME: workaround for #154536
- result.getBounds().setSize(result.getPreferredSize());
- return result;
- }
-
- /**
- * @generated
- */
- protected IFigure createNodeShape() {
- return primaryShape = new PseudostateExitPointFigure();
- }
-
- /**
- * @generated
- */
- public IFigure getContentPane() {
- if(contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSource() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSourceAndTarget(IGraphicalEditPart targetEditPart) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(targetEditPart instanceof FinalStateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof StateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateInitialEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateJoinEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateForkEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateChoiceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateJunctionEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateShallowHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateDeepHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateTerminateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateEntryPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof ConnectionPointReferenceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnTarget() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForSource(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForTarget(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- @Override
- public Object getPreferredValue(EStructuralFeature feature) {
- 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("Pseudostate", PreferenceConstantHelper.COLOR_LINE);
- } else if(feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_FONT);
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_FILL);
- }
- result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor((IPreferenceStore)preferenceStore, prefColor));
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
- String prefGradient = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_GRADIENT);
- 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;
- }
-
- /**
- * @generated
- */
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(PseudostateExitPointNameEditPart.VISUAL_ID));
- }
-
- /**
- * @generated
- */
- public PseudostateExitPointFigure getPrimaryShape() {
- return (PseudostateExitPointFigure)primaryShape;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- protected void setForegroundColor(Color color) {
- if(primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineType(int style) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineWidth(int width) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineWidth(width);
- }
- }
-
- /**
- * 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(IFigure nodeShape) {
- return nodeShape; // use nodeShape itself as contentPane
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateExitPointNameEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateExitPointNameEditPart.java
deleted file mode 100644
index 5a20d24aef6..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateExitPointNameEditPart.java
+++ /dev/null
@@ -1,746 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class PseudostateExitPointNameEditPart
-
-extends LabelEditPart
-
-implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 17001;
-
- /**
- * @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.diagram.statemachine.edit.parts.PseudostateExitPointNameEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public PseudostateExitPointNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- }
-
- /**
- * @generated
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new WrappingLabel();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Pseudostate_17000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateExitPointStereotypeEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateExitPointStereotypeEditPart.java
deleted file mode 100644
index d02fe61e2c6..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateExitPointStereotypeEditPart.java
+++ /dev/null
@@ -1,750 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editparts.AbstractLabelEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class PseudostateExitPointStereotypeEditPart
-
-extends AbstractLabelEditPart
-
-implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 17002;
-
- /**
- * @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.diagram.statemachine.edit.parts.PseudostateExitPointStereotypeEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public PseudostateExitPointStereotypeEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- 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
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new AppliedStereotypeWrappingLabelFigure();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Pseudostate_17000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointStereotypeEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateForkEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateForkEditPart.java
deleted file mode 100644
index ff14f917c4e..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateForkEditPart.java
+++ /dev/null
@@ -1,401 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.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.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.diagram.common.editparts.UMLNodeEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.papyrus.diagram.common.locator.ExternalLabelPositionLocator;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.PseudostateJoinForkFigure;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomPseudostateForkJoinResizeEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.PseudostateForkItemSemanticEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class PseudostateForkEditPart extends
-
-UMLNodeEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 10000;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public PseudostateForkEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
- if(borderItemEditPart instanceof PseudostateForkNameEditPart) {
- IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else if(borderItemEditPart instanceof PseudostateForkStereotypeEditPart) {
- IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else {
- super.addBorderItem(borderItemContainer, borderItemEditPart);
- }
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PseudostateForkItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new CustomPseudostateForkJoinResizeEditPolicy());
- // 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() {
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
-
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View)child.getModel();
- switch(UMLVisualIDRegistry.getVisualID(childView)) {
- case PseudostateForkNameEditPart.VISUAL_ID:
- case PseudostateForkStereotypeEditPart.VISUAL_ID:
- return new BorderItemSelectionEditPolicy() {
-
- protected List createSelectionHandles() {
- 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;
- }
-
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * 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
- */
- protected NodeFigure createMainFigure() {
- NodeFigure figure = createNodePlate();
- figure.setLayoutManager(new StackLayout());
- IFigure shape = createNodeShape();
- figure.add(shape);
- contentPane = setupContentPane(shape);
- return figure;
- }
-
- /**
- * @generated
- */
- protected NodeFigure createNodePlate() {
- String prefElementId = "Pseudostate";
- IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
- String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
- String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
- DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
-
- return result;
- }
-
- /**
- * @generated
- */
- protected IFigure createNodeShape() {
- return primaryShape = new PseudostateJoinForkFigure();
- }
-
- /**
- * @generated
- */
- public IFigure getContentPane() {
- if(contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSource() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSourceAndTarget(IGraphicalEditPart targetEditPart) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(targetEditPart instanceof FinalStateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof StateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateInitialEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateJoinEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateForkEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateChoiceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateJunctionEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateShallowHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateDeepHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateTerminateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateEntryPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateExitPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof ConnectionPointReferenceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnTarget() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForSource(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForTarget(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- @Override
- public Object getPreferredValue(EStructuralFeature feature) {
- 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("Pseudostate", PreferenceConstantHelper.COLOR_LINE);
- } else if(feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_FONT);
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_FILL);
- }
- result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor((IPreferenceStore)preferenceStore, prefColor));
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
- String prefGradient = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_GRADIENT);
- 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;
- }
-
- /**
- * @generated
- */
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(PseudostateForkNameEditPart.VISUAL_ID));
- }
-
- /**
- * @generated
- */
- public PseudostateJoinForkFigure getPrimaryShape() {
- return (PseudostateJoinForkFigure)primaryShape;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- protected void setForegroundColor(Color color) {
- if(primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineType(int style) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineWidth(int width) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineWidth(width);
- }
- }
-
- /**
- * 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(IFigure nodeShape) {
- return nodeShape; // use nodeShape itself as contentPane
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateForkNameEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateForkNameEditPart.java
deleted file mode 100644
index 069ac8b12f4..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateForkNameEditPart.java
+++ /dev/null
@@ -1,746 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class PseudostateForkNameEditPart
-
-extends LabelEditPart
-
-implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 10001;
-
- /**
- * @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.diagram.statemachine.edit.parts.PseudostateForkNameEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public PseudostateForkNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- }
-
- /**
- * @generated
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new WrappingLabel();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Pseudostate_10000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateForkNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateForkStereotypeEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateForkStereotypeEditPart.java
deleted file mode 100644
index b8091ec6406..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateForkStereotypeEditPart.java
+++ /dev/null
@@ -1,750 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editparts.AbstractLabelEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class PseudostateForkStereotypeEditPart
-
-extends AbstractLabelEditPart
-
-implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 10002;
-
- /**
- * @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.diagram.statemachine.edit.parts.PseudostateForkStereotypeEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public PseudostateForkStereotypeEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- 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
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new AppliedStereotypeWrappingLabelFigure();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Pseudostate_10000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateForkStereotypeEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateInitialEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateInitialEditPart.java
deleted file mode 100644
index f6a3c826f8c..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateInitialEditPart.java
+++ /dev/null
@@ -1,399 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.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.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.diagram.common.editparts.UMLNodeEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.papyrus.diagram.common.locator.ExternalLabelPositionLocator;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.PseudostateInitialFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.PseudostateInitialItemSemanticEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class PseudostateInitialEditPart extends
-
-UMLNodeEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 8000;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public PseudostateInitialEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
- if(borderItemEditPart instanceof PseudostateInitialNameEditPart) {
- IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else if(borderItemEditPart instanceof PseudostateInitialStereotypeEditPart) {
- IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else {
- super.addBorderItem(borderItemContainer, borderItemEditPart);
- }
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PseudostateInitialItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- // 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() {
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
-
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View)child.getModel();
- switch(UMLVisualIDRegistry.getVisualID(childView)) {
- case PseudostateInitialNameEditPart.VISUAL_ID:
- case PseudostateInitialStereotypeEditPart.VISUAL_ID:
- return new BorderItemSelectionEditPolicy() {
-
- protected List createSelectionHandles() {
- 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;
- }
-
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * 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
- */
- protected NodeFigure createMainFigure() {
- NodeFigure figure = createNodePlate();
- figure.setLayoutManager(new StackLayout());
- IFigure shape = createNodeShape();
- figure.add(shape);
- contentPane = setupContentPane(shape);
- return figure;
- }
-
- /**
- * @generated
- */
- protected NodeFigure createNodePlate() {
- String prefElementId = "Pseudostate";
- IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
- String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
- String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
- DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
-
- return result;
- }
-
- /**
- * @generated
- */
- protected IFigure createNodeShape() {
- return primaryShape = new PseudostateInitialFigure();
- }
-
- /**
- * @generated
- */
- public IFigure getContentPane() {
- if(contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSource() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSourceAndTarget(IGraphicalEditPart targetEditPart) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(targetEditPart instanceof FinalStateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof StateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateInitialEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateJoinEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateForkEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateChoiceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateJunctionEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateShallowHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateDeepHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateTerminateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateEntryPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateExitPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof ConnectionPointReferenceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnTarget() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForSource(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForTarget(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- @Override
- public Object getPreferredValue(EStructuralFeature feature) {
- 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("Pseudostate", PreferenceConstantHelper.COLOR_LINE);
- } else if(feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_FONT);
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_FILL);
- }
- result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor((IPreferenceStore)preferenceStore, prefColor));
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
- String prefGradient = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_GRADIENT);
- 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;
- }
-
- /**
- * @generated
- */
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(PseudostateInitialNameEditPart.VISUAL_ID));
- }
-
- /**
- * @generated
- */
- public PseudostateInitialFigure getPrimaryShape() {
- return (PseudostateInitialFigure)primaryShape;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- protected void setForegroundColor(Color color) {
- if(primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineType(int style) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineWidth(int width) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineWidth(width);
- }
- }
-
- /**
- * 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(IFigure nodeShape) {
- return nodeShape; // use nodeShape itself as contentPane
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateInitialNameEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateInitialNameEditPart.java
deleted file mode 100644
index cd7e001687e..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateInitialNameEditPart.java
+++ /dev/null
@@ -1,746 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class PseudostateInitialNameEditPart
-
-extends LabelEditPart
-
-implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 8001;
-
- /**
- * @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.diagram.statemachine.edit.parts.PseudostateInitialNameEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public PseudostateInitialNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- }
-
- /**
- * @generated
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new WrappingLabel();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Pseudostate_8000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateInitialNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateInitialStereotypeEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateInitialStereotypeEditPart.java
deleted file mode 100644
index ca7dd710089..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateInitialStereotypeEditPart.java
+++ /dev/null
@@ -1,750 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editparts.AbstractLabelEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class PseudostateInitialStereotypeEditPart
-
-extends AbstractLabelEditPart
-
-implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 8002;
-
- /**
- * @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.diagram.statemachine.edit.parts.PseudostateInitialStereotypeEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public PseudostateInitialStereotypeEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- 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
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new AppliedStereotypeWrappingLabelFigure();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Pseudostate_8000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateInitialStereotypeEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateJoinEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateJoinEditPart.java
deleted file mode 100644
index 39f08812feb..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateJoinEditPart.java
+++ /dev/null
@@ -1,401 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.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.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.diagram.common.editparts.UMLNodeEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.papyrus.diagram.common.locator.ExternalLabelPositionLocator;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.PseudostateJoinForkFigure;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomPseudostateForkJoinResizeEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.PseudostateJoinItemSemanticEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class PseudostateJoinEditPart extends
-
-UMLNodeEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 9000;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public PseudostateJoinEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
- if(borderItemEditPart instanceof PseudostateJoinNameEditPart) {
- IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else if(borderItemEditPart instanceof PseudostateJoinStereotypeEditPart) {
- IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else {
- super.addBorderItem(borderItemContainer, borderItemEditPart);
- }
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PseudostateJoinItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new CustomPseudostateForkJoinResizeEditPolicy());
- // 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() {
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
-
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View)child.getModel();
- switch(UMLVisualIDRegistry.getVisualID(childView)) {
- case PseudostateJoinNameEditPart.VISUAL_ID:
- case PseudostateJoinStereotypeEditPart.VISUAL_ID:
- return new BorderItemSelectionEditPolicy() {
-
- protected List createSelectionHandles() {
- 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;
- }
-
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * 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
- */
- protected NodeFigure createMainFigure() {
- NodeFigure figure = createNodePlate();
- figure.setLayoutManager(new StackLayout());
- IFigure shape = createNodeShape();
- figure.add(shape);
- contentPane = setupContentPane(shape);
- return figure;
- }
-
- /**
- * @generated
- */
- protected NodeFigure createNodePlate() {
- String prefElementId = "Pseudostate";
- IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
- String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
- String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
- DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
-
- return result;
- }
-
- /**
- * @generated
- */
- protected IFigure createNodeShape() {
- return primaryShape = new PseudostateJoinForkFigure();
- }
-
- /**
- * @generated
- */
- public IFigure getContentPane() {
- if(contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSource() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSourceAndTarget(IGraphicalEditPart targetEditPart) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(targetEditPart instanceof FinalStateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof StateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateInitialEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJoinEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateForkEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateChoiceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateJunctionEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateShallowHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateDeepHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateTerminateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateEntryPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateExitPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof ConnectionPointReferenceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnTarget() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForSource(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForTarget(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- @Override
- public Object getPreferredValue(EStructuralFeature feature) {
- 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("Pseudostate", PreferenceConstantHelper.COLOR_LINE);
- } else if(feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_FONT);
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_FILL);
- }
- result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor((IPreferenceStore)preferenceStore, prefColor));
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
- String prefGradient = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_GRADIENT);
- 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;
- }
-
- /**
- * @generated
- */
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(PseudostateJoinNameEditPart.VISUAL_ID));
- }
-
- /**
- * @generated
- */
- public PseudostateJoinForkFigure getPrimaryShape() {
- return (PseudostateJoinForkFigure)primaryShape;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- protected void setForegroundColor(Color color) {
- if(primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineType(int style) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineWidth(int width) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineWidth(width);
- }
- }
-
- /**
- * 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(IFigure nodeShape) {
- return nodeShape; // use nodeShape itself as contentPane
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateJoinNameEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateJoinNameEditPart.java
deleted file mode 100644
index 768efd54ecb..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateJoinNameEditPart.java
+++ /dev/null
@@ -1,746 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class PseudostateJoinNameEditPart
-
-extends LabelEditPart
-
-implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 9001;
-
- /**
- * @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.diagram.statemachine.edit.parts.PseudostateJoinNameEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public PseudostateJoinNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- }
-
- /**
- * @generated
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new WrappingLabel();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Pseudostate_9000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJoinNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateJoinStereotypeEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateJoinStereotypeEditPart.java
deleted file mode 100644
index c3e739a22d5..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateJoinStereotypeEditPart.java
+++ /dev/null
@@ -1,750 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editparts.AbstractLabelEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class PseudostateJoinStereotypeEditPart
-
-extends AbstractLabelEditPart
-
-implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 9002;
-
- /**
- * @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.diagram.statemachine.edit.parts.PseudostateJoinStereotypeEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public PseudostateJoinStereotypeEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- 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
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new AppliedStereotypeWrappingLabelFigure();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Pseudostate_9000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJoinStereotypeEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateJunctionEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateJunctionEditPart.java
deleted file mode 100644
index 87233edc33b..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateJunctionEditPart.java
+++ /dev/null
@@ -1,399 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.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.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.diagram.common.editparts.UMLNodeEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.papyrus.diagram.common.locator.ExternalLabelPositionLocator;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.PseudostateJunctionFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.PseudostateJunctionItemSemanticEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class PseudostateJunctionEditPart extends
-
-UMLNodeEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 12000;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public PseudostateJunctionEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
- if(borderItemEditPart instanceof PseudostateJunctionNameEditPart) {
- IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else if(borderItemEditPart instanceof PseudostateJunctionStereotypeEditPart) {
- IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else {
- super.addBorderItem(borderItemContainer, borderItemEditPart);
- }
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PseudostateJunctionItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- // 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() {
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
-
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View)child.getModel();
- switch(UMLVisualIDRegistry.getVisualID(childView)) {
- case PseudostateJunctionNameEditPart.VISUAL_ID:
- case PseudostateJunctionStereotypeEditPart.VISUAL_ID:
- return new BorderItemSelectionEditPolicy() {
-
- protected List createSelectionHandles() {
- 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;
- }
-
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * 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
- */
- protected NodeFigure createMainFigure() {
- NodeFigure figure = createNodePlate();
- figure.setLayoutManager(new StackLayout());
- IFigure shape = createNodeShape();
- figure.add(shape);
- contentPane = setupContentPane(shape);
- return figure;
- }
-
- /**
- * @generated
- */
- protected NodeFigure createNodePlate() {
- String prefElementId = "Pseudostate";
- IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
- String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
- String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
- DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
-
- return result;
- }
-
- /**
- * @generated
- */
- protected IFigure createNodeShape() {
- return primaryShape = new PseudostateJunctionFigure();
- }
-
- /**
- * @generated
- */
- public IFigure getContentPane() {
- if(contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSource() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSourceAndTarget(IGraphicalEditPart targetEditPart) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(targetEditPart instanceof FinalStateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof StateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateInitialEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateJoinEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateForkEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateChoiceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJunctionEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateShallowHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateDeepHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateTerminateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateEntryPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateExitPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof ConnectionPointReferenceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnTarget() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForSource(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForTarget(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- @Override
- public Object getPreferredValue(EStructuralFeature feature) {
- 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("Pseudostate", PreferenceConstantHelper.COLOR_LINE);
- } else if(feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_FONT);
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_FILL);
- }
- result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor((IPreferenceStore)preferenceStore, prefColor));
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
- String prefGradient = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_GRADIENT);
- 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;
- }
-
- /**
- * @generated
- */
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(PseudostateJunctionNameEditPart.VISUAL_ID));
- }
-
- /**
- * @generated
- */
- public PseudostateJunctionFigure getPrimaryShape() {
- return (PseudostateJunctionFigure)primaryShape;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- protected void setForegroundColor(Color color) {
- if(primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineType(int style) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineWidth(int width) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineWidth(width);
- }
- }
-
- /**
- * 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(IFigure nodeShape) {
- return nodeShape; // use nodeShape itself as contentPane
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateJunctionNameEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateJunctionNameEditPart.java
deleted file mode 100644
index b0916d25317..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateJunctionNameEditPart.java
+++ /dev/null
@@ -1,746 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class PseudostateJunctionNameEditPart
-
-extends LabelEditPart
-
-implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 12001;
-
- /**
- * @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.diagram.statemachine.edit.parts.PseudostateJunctionNameEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public PseudostateJunctionNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- }
-
- /**
- * @generated
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new WrappingLabel();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Pseudostate_12000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJunctionNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateJunctionStereotypeEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateJunctionStereotypeEditPart.java
deleted file mode 100644
index 44bd6f6ed0e..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateJunctionStereotypeEditPart.java
+++ /dev/null
@@ -1,750 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editparts.AbstractLabelEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class PseudostateJunctionStereotypeEditPart
-
-extends AbstractLabelEditPart
-
-implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 12002;
-
- /**
- * @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.diagram.statemachine.edit.parts.PseudostateJunctionStereotypeEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public PseudostateJunctionStereotypeEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- 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
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new AppliedStereotypeWrappingLabelFigure();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Pseudostate_12000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJunctionStereotypeEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateShallowHistoryEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateShallowHistoryEditPart.java
deleted file mode 100644
index 6ad05f37a18..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateShallowHistoryEditPart.java
+++ /dev/null
@@ -1,399 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.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.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.diagram.common.editparts.UMLNodeEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.papyrus.diagram.common.locator.ExternalLabelPositionLocator;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.PseudostateShallowHistoryFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.PseudostateShallowHistoryItemSemanticEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class PseudostateShallowHistoryEditPart extends
-
-UMLNodeEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 13000;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public PseudostateShallowHistoryEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
- if(borderItemEditPart instanceof PseudostateShallowHistoryNameEditPart) {
- IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else if(borderItemEditPart instanceof PseudostateShallowHistoryStereotypeEditPart) {
- IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else {
- super.addBorderItem(borderItemContainer, borderItemEditPart);
- }
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PseudostateShallowHistoryItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- // 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() {
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
-
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View)child.getModel();
- switch(UMLVisualIDRegistry.getVisualID(childView)) {
- case PseudostateShallowHistoryNameEditPart.VISUAL_ID:
- case PseudostateShallowHistoryStereotypeEditPart.VISUAL_ID:
- return new BorderItemSelectionEditPolicy() {
-
- protected List createSelectionHandles() {
- 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;
- }
-
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * 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
- */
- protected NodeFigure createMainFigure() {
- NodeFigure figure = createNodePlate();
- figure.setLayoutManager(new StackLayout());
- IFigure shape = createNodeShape();
- figure.add(shape);
- contentPane = setupContentPane(shape);
- return figure;
- }
-
- /**
- * @generated
- */
- protected NodeFigure createNodePlate() {
- String prefElementId = "Pseudostate";
- IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
- String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
- String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
- DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
-
- return result;
- }
-
- /**
- * @generated
- */
- protected IFigure createNodeShape() {
- return primaryShape = new PseudostateShallowHistoryFigure();
- }
-
- /**
- * @generated
- */
- public IFigure getContentPane() {
- if(contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSource() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSourceAndTarget(IGraphicalEditPart targetEditPart) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(targetEditPart instanceof FinalStateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof StateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateInitialEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateJoinEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateForkEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateChoiceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateJunctionEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateShallowHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateDeepHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateTerminateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateEntryPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateExitPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof ConnectionPointReferenceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnTarget() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForSource(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForTarget(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- @Override
- public Object getPreferredValue(EStructuralFeature feature) {
- 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("Pseudostate", PreferenceConstantHelper.COLOR_LINE);
- } else if(feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_FONT);
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_FILL);
- }
- result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor((IPreferenceStore)preferenceStore, prefColor));
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
- String prefGradient = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_GRADIENT);
- 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;
- }
-
- /**
- * @generated
- */
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(PseudostateShallowHistoryNameEditPart.VISUAL_ID));
- }
-
- /**
- * @generated
- */
- public PseudostateShallowHistoryFigure getPrimaryShape() {
- return (PseudostateShallowHistoryFigure)primaryShape;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- protected void setForegroundColor(Color color) {
- if(primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineType(int style) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineWidth(int width) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineWidth(width);
- }
- }
-
- /**
- * 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(IFigure nodeShape) {
- return nodeShape; // use nodeShape itself as contentPane
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateShallowHistoryNameEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateShallowHistoryNameEditPart.java
deleted file mode 100644
index 6be98083c18..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateShallowHistoryNameEditPart.java
+++ /dev/null
@@ -1,746 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class PseudostateShallowHistoryNameEditPart
-
-extends LabelEditPart
-
-implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 13001;
-
- /**
- * @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.diagram.statemachine.edit.parts.PseudostateShallowHistoryNameEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public PseudostateShallowHistoryNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- }
-
- /**
- * @generated
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new WrappingLabel();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Pseudostate_13000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateShallowHistoryNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateShallowHistoryStereotypeEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateShallowHistoryStereotypeEditPart.java
deleted file mode 100644
index 36fd55dd4f6..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateShallowHistoryStereotypeEditPart.java
+++ /dev/null
@@ -1,750 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editparts.AbstractLabelEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class PseudostateShallowHistoryStereotypeEditPart
-
-extends AbstractLabelEditPart
-
-implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 13002;
-
- /**
- * @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.diagram.statemachine.edit.parts.PseudostateShallowHistoryStereotypeEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public PseudostateShallowHistoryStereotypeEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- 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
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new AppliedStereotypeWrappingLabelFigure();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Pseudostate_13000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateShallowHistoryStereotypeEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateTerminateEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateTerminateEditPart.java
deleted file mode 100644
index 49affeaff7c..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateTerminateEditPart.java
+++ /dev/null
@@ -1,399 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.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.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.diagram.common.editparts.UMLNodeEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.papyrus.diagram.common.locator.ExternalLabelPositionLocator;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.PseudostateTerminateFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.PseudostateTerminateItemSemanticEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class PseudostateTerminateEditPart extends
-
-UMLNodeEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 15000;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public PseudostateTerminateEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
- if(borderItemEditPart instanceof PseudostateTerminateNameEditPart) {
- IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else if(borderItemEditPart instanceof PseudostateTerminateStereotypeEditPart) {
- IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else {
- super.addBorderItem(borderItemContainer, borderItemEditPart);
- }
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PseudostateTerminateItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- // 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() {
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
-
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View)child.getModel();
- switch(UMLVisualIDRegistry.getVisualID(childView)) {
- case PseudostateTerminateNameEditPart.VISUAL_ID:
- case PseudostateTerminateStereotypeEditPart.VISUAL_ID:
- return new BorderItemSelectionEditPolicy() {
-
- protected List createSelectionHandles() {
- 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;
- }
-
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * 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
- */
- protected NodeFigure createMainFigure() {
- NodeFigure figure = createNodePlate();
- figure.setLayoutManager(new StackLayout());
- IFigure shape = createNodeShape();
- figure.add(shape);
- contentPane = setupContentPane(shape);
- return figure;
- }
-
- /**
- * @generated
- */
- protected NodeFigure createNodePlate() {
- String prefElementId = "Pseudostate";
- IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
- String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
- String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
- DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
-
- return result;
- }
-
- /**
- * @generated
- */
- protected IFigure createNodeShape() {
- return primaryShape = new PseudostateTerminateFigure();
- }
-
- /**
- * @generated
- */
- public IFigure getContentPane() {
- if(contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSource() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSourceAndTarget(IGraphicalEditPart targetEditPart) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(targetEditPart instanceof FinalStateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof StateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateInitialEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateJoinEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateForkEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateChoiceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateJunctionEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateShallowHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateDeepHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateTerminateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateEntryPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateExitPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof ConnectionPointReferenceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnTarget() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForSource(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForTarget(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- @Override
- public Object getPreferredValue(EStructuralFeature feature) {
- 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("Pseudostate", PreferenceConstantHelper.COLOR_LINE);
- } else if(feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_FONT);
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_FILL);
- }
- result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor((IPreferenceStore)preferenceStore, prefColor));
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
- String prefGradient = PreferenceConstantHelper.getElementConstant("Pseudostate", PreferenceConstantHelper.COLOR_GRADIENT);
- 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;
- }
-
- /**
- * @generated
- */
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(PseudostateTerminateNameEditPart.VISUAL_ID));
- }
-
- /**
- * @generated
- */
- public PseudostateTerminateFigure getPrimaryShape() {
- return (PseudostateTerminateFigure)primaryShape;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- protected void setForegroundColor(Color color) {
- if(primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineType(int style) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineWidth(int width) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineWidth(width);
- }
- }
-
- /**
- * 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(IFigure nodeShape) {
- return nodeShape; // use nodeShape itself as contentPane
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateTerminateNameEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateTerminateNameEditPart.java
deleted file mode 100644
index f015b955021..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateTerminateNameEditPart.java
+++ /dev/null
@@ -1,746 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class PseudostateTerminateNameEditPart
-
-extends LabelEditPart
-
-implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 15001;
-
- /**
- * @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.diagram.statemachine.edit.parts.PseudostateTerminateNameEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public PseudostateTerminateNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- }
-
- /**
- * @generated
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new WrappingLabel();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Pseudostate_15000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateTerminateNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateTerminateStereotypeEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateTerminateStereotypeEditPart.java
deleted file mode 100644
index ad955517e2b..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/PseudostateTerminateStereotypeEditPart.java
+++ /dev/null
@@ -1,750 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editparts.AbstractLabelEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class PseudostateTerminateStereotypeEditPart
-
-extends AbstractLabelEditPart
-
-implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 15002;
-
- /**
- * @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.diagram.statemachine.edit.parts.PseudostateTerminateStereotypeEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public PseudostateTerminateStereotypeEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- 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
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new AppliedStereotypeWrappingLabelFigure();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IBorderItemLocator getBorderItemLocator() {
- IFigure parentFigure = getFigure().getParent();
- if(parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (IBorderItemLocator)constraint;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Pseudostate_15000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateTerminateStereotypeEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- public void refreshBounds() {
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/RegionCompartmentEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/RegionCompartmentEditPart.java
deleted file mode 100644
index c1ca0b7b5d9..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/RegionCompartmentEditPart.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.CreationEditPolicy;
-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.diagram.common.editpolicies.DuplicatePasteEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomRegionCompartmentCreationEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomRegionCompartmentXYLayoutEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateMachineDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.RemoveOrphanViewPolicy;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.RegionCompartmentItemSemanticEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.Messages;
-
-/**
- * @generated
- */
-public class RegionCompartmentEditPart
-
-extends ShapeCompartmentEditPart
-
-{
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 3002;
-
- /**
- * @generated
- */
- public RegionCompartmentEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new RegionCompartmentItemSemanticEditPolicy());
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
- installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
-
- //in Papyrus diagrams are not strongly synchronised
- //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.diagram.statemachine.edit.policies.RegionCompartmentCanonicalEditPolicy());
-
- installEditPolicy("RemoveOrphanView", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CustomRegionCompartmentCreationEditPolicy());
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomStateMachineDiagramDragDropEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, new CustomRegionCompartmentXYLayoutEditPolicy());
- }
-
- /**
- * @generated
- */
- public IFigure createFigure() {
- ResizableCompartmentFigure result = (ResizableCompartmentFigure)super.createFigure();
- result.setTitleVisibility(false);
- return result;
- }
-
- /**
- * @generated
- */
- public String getCompartmentName() {
- return Messages.RegionCompartmentEditPart_title;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification notification) {
- 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() {
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- Dimension size = new Dimension(width, height);
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- Point loc = new Point(x, y);
- ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshBounds();
- }
-
- /**
- * @generated
- */
- protected void setRatio(Double ratio) {
- if(getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
- super.setRatio(ratio);
- }
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/RegionEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/RegionEditPart.java
deleted file mode 100644
index 065aac397de..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/RegionEditPart.java
+++ /dev/null
@@ -1,304 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.diagram.common.editparts.NamedElementEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
-import org.eclipse.papyrus.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.RegionFigure;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomRegionComponentEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomRegionItemSemanticEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.RegionItemSemanticEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class RegionEditPart extends
-
-NamedElementEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 3000;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public RegionEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addChildVisual(EditPart childEditPart, int index) {
- if(addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
-
- if(childEditPart instanceof RegionCompartmentEditPart) {
- IFigure pane = getPrimaryShape().getRegionCompartmentFigure();
- setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
- pane.add(((RegionCompartmentEditPart)childEditPart).getFigure());
- return true;
- }
-
- return false;
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new RegionItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomRegionItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.COMPONENT_ROLE, new CustomRegionComponentEditPolicy());
- installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
- // 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() {
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
-
- protected EditPolicy createChildEditPolicy(EditPart child) {
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * 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
- */
- protected NodeFigure createNodeFigure() {
- NodeFigure figure = createNodePlate();
- figure.setLayoutManager(new StackLayout());
- IFigure shape = createNodeShape();
- figure.add(shape);
- contentPane = setupContentPane(shape);
- return figure;
- }
-
- /**
- * @generated
- */
- protected NodeFigure createNodePlate() {
- String prefElementId = "Region";
- IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
- String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
- String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
- DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
-
- return result;
- }
-
- /**
- * @generated
- */
- protected IFigure createNodeShape() {
- return primaryShape = new RegionFigure();
- }
-
- /**
- * @generated
- */
- public IFigure getContentPane() {
- if(contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- if(editPart instanceof RegionCompartmentEditPart) {
- return getPrimaryShape().getRegionCompartmentFigure();
- }
- return getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- public Object getPreferredValue(EStructuralFeature feature) {
- 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("Region", PreferenceConstantHelper.COLOR_LINE);
- } else if(feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Region", PreferenceConstantHelper.COLOR_FONT);
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("Region", PreferenceConstantHelper.COLOR_FILL);
- }
- result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor((IPreferenceStore)preferenceStore, prefColor));
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
- String prefGradient = PreferenceConstantHelper.getElementConstant("Region", PreferenceConstantHelper.COLOR_GRADIENT);
- 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;
- }
-
- /**
- * @generated
- */
- public RegionFigure getPrimaryShape() {
- return (RegionFigure)primaryShape;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- protected void removeChildVisual(EditPart childEditPart) {
- if(removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if(childEditPart instanceof RegionCompartmentEditPart) {
- IFigure pane = getPrimaryShape().getRegionCompartmentFigure();
- setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
- pane.remove(((RegionCompartmentEditPart)childEditPart).getFigure());
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- protected void setForegroundColor(Color color) {
- if(primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineType(int style) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineWidth(int width) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineWidth(width);
- }
- }
-
- /**
- * 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(IFigure nodeShape) {
- if(nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/StateCompartmentEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/StateCompartmentEditPart.java
deleted file mode 100644
index 153e6a3dca6..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/StateCompartmentEditPart.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.CreationEditPolicy;
-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.diagram.common.editpolicies.DuplicatePasteEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateCompartmentCreationEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateCompartmentXYLayoutEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateMachineDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.RemoveOrphanViewPolicy;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.StateCompartmentItemSemanticEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.Messages;
-
-/**
- * @generated
- */
-public class StateCompartmentEditPart
-
-extends ShapeCompartmentEditPart
-
-{
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 6002;
-
- /**
- * @generated
- */
- public StateCompartmentEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new StateCompartmentItemSemanticEditPolicy());
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
- installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
-
- //in Papyrus diagrams are not strongly synchronised
- //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.diagram.statemachine.edit.policies.StateCompartmentCanonicalEditPolicy());
-
- installEditPolicy("RemoveOrphanView", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
- installEditPolicy(EditPolicy.LAYOUT_ROLE, new CustomStateCompartmentXYLayoutEditPolicy());
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomStateMachineDiagramDragDropEditPolicy());
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CustomStateCompartmentCreationEditPolicy());
- }
-
- /**
- * @generated
- */
- public IFigure createFigure() {
- ResizableCompartmentFigure result = (ResizableCompartmentFigure)super.createFigure();
- result.setTitleVisibility(false);
- return result;
- }
-
- /**
- * @generated
- */
- public String getCompartmentName() {
- return Messages.StateCompartmentEditPart_title;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification notification) {
- 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() {
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- Dimension size = new Dimension(width, height);
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- Point loc = new Point(x, y);
- ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshBounds();
- }
-
- /**
- * @generated
- */
- protected void setRatio(Double ratio) {
- if(getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
- super.setRatio(ratio);
- }
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/StateEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/StateEditPart.java
deleted file mode 100644
index 500e625f9ed..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/StateEditPart.java
+++ /dev/null
@@ -1,507 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
-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.IBorderItemLocator;
-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.diagram.common.editparts.NamedElementEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AffixedNodeAlignmentEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.BorderItemResizableEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.NavigationEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
-import org.eclipse.papyrus.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.StateFigure;
-import org.eclipse.papyrus.diagram.statemachine.custom.locators.CustomEntryExitPointPositionLocator;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateCreationEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateItemSemanticEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateLayoutEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateMachineDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.StateItemSemanticEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class StateEditPart extends
-
-NamedElementEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 6000;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public StateEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addChildVisual(EditPart childEditPart, int index) {
- if(addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if(childEditPart instanceof StateNameEditPart) {
- ((StateNameEditPart)childEditPart).setLabel(getPrimaryShape().getNameLabel());
- return true;
- }
-
- if(childEditPart instanceof StateCompartmentEditPart) {
- IFigure pane = getPrimaryShape().getStateCompartmentFigure();
- setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
- pane.add(((StateCompartmentEditPart)childEditPart).getFigure());
- return true;
- }
-
- //Papyrus Gencode :Affixed EntryExitPoints ConnectionPointReferences Locator
- if(childEditPart instanceof PseudostateEntryPointEditPart) {
- IBorderItemLocator locator = new CustomEntryExitPointPositionLocator(getMainFigure(), PositionConstants.NONE);
- getBorderedFigure().getBorderItemContainer().add(((PseudostateEntryPointEditPart)childEditPart).getFigure(), locator);
- return true;
- }
-
- //Papyrus Gencode :Affixed EntryExitPoints ConnectionPointReferences Locator
- if(childEditPart instanceof PseudostateExitPointEditPart) {
- IBorderItemLocator locator = new CustomEntryExitPointPositionLocator(getMainFigure(), PositionConstants.NONE);
- getBorderedFigure().getBorderItemContainer().add(((PseudostateExitPointEditPart)childEditPart).getFigure(), locator);
- return true;
- }
-
- //Papyrus Gencode :Affixed EntryExitPoints ConnectionPointReferences Locator
- if(childEditPart instanceof ConnectionPointReferenceEditPart) {
- IBorderItemLocator locator = new CustomEntryExitPointPositionLocator(getMainFigure(), PositionConstants.NONE);
- getBorderedFigure().getBorderItemContainer().add(((ConnectionPointReferenceEditPart)childEditPart).getFigure(), locator);
- return true;
- }
-
- return false;
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new StateItemSemanticEditPolicy());
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
-
- //in Papyrus diagrams are not strongly synchronised
- //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.diagram.statemachine.edit.policies.StateCanonicalEditPolicy());
-
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, new CustomStateLayoutEditPolicy());
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomStateMachineDiagramDragDropEditPolicy());
- installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CustomStateCreationEditPolicy());
- installEditPolicy(AffixedNodeAlignmentEditPolicy.AFFIXED_CHILD_ALIGNMENT_ROLE, new AffixedNodeAlignmentEditPolicy());
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomStateItemSemanticEditPolicy());
- installEditPolicy(NavigationEditPolicy.NAVIGATION_POLICY, new NavigationEditPolicy());
- // 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() {
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
-
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View)child.getModel();
- switch(UMLVisualIDRegistry.getVisualID(childView)) {
- case PseudostateEntryPointEditPart.VISUAL_ID:
- case PseudostateExitPointEditPart.VISUAL_ID:
- case ConnectionPointReferenceEditPart.VISUAL_ID:
-
- return new BorderItemResizableEditPolicy();
-
- }
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * 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
- */
- protected NodeFigure createMainFigure() {
- NodeFigure figure = createNodePlate();
- figure.setLayoutManager(new StackLayout());
- IFigure shape = createNodeShape();
- figure.add(shape);
- contentPane = setupContentPane(shape);
- return figure;
- }
-
- /**
- * @generated
- */
- protected NodeFigure createNodePlate() {
- String prefElementId = "State";
- IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
- String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
- String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
- DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
-
- return result;
- }
-
- /**
- * @generated
- */
- protected IFigure createNodeShape() {
- return primaryShape = new StateFigure();
- }
-
- /**
- * @generated
- */
- public IFigure getContentPane() {
- if(contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- if(editPart instanceof StateCompartmentEditPart) {
- return getPrimaryShape().getStateCompartmentFigure();
- }
- if(editPart instanceof IBorderItemEditPart) {
- return getBorderedFigure().getBorderItemContainer();
- }
- return getContentPane();
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSource() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSourceAndTarget(IGraphicalEditPart targetEditPart) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(targetEditPart instanceof FinalStateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof org.eclipse.papyrus.diagram.statemachine.edit.parts.StateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateInitialEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateJoinEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateForkEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateChoiceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateJunctionEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateShallowHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateDeepHistoryEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateTerminateEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateEntryPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof PseudostateExitPointEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- if(targetEditPart instanceof ConnectionPointReferenceEditPart) {
- types.add(UMLElementTypes.Transition_7000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnTarget() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForSource(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForTarget(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Transition_7000) {
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- @Override
- public Object getPreferredValue(EStructuralFeature feature) {
- 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("State", PreferenceConstantHelper.COLOR_LINE);
- } else if(feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("State", PreferenceConstantHelper.COLOR_FONT);
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("State", PreferenceConstantHelper.COLOR_FILL);
- }
- result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor((IPreferenceStore)preferenceStore, prefColor));
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
- String prefGradient = PreferenceConstantHelper.getElementConstant("State", PreferenceConstantHelper.COLOR_GRADIENT);
- 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;
- }
-
- /**
- * @generated
- */
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(StateNameEditPart.VISUAL_ID));
- }
-
- /**
- * @generated
- */
- public StateFigure getPrimaryShape() {
- return (StateFigure)primaryShape;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- protected void removeChildVisual(EditPart childEditPart) {
- if(removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if(childEditPart instanceof StateNameEditPart) {
- return true;
- }
- if(childEditPart instanceof StateCompartmentEditPart) {
- IFigure pane = getPrimaryShape().getStateCompartmentFigure();
- setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
- pane.remove(((StateCompartmentEditPart)childEditPart).getFigure());
- return true;
- }
- if(childEditPart instanceof PseudostateEntryPointEditPart) {
- getBorderedFigure().getBorderItemContainer().remove(((PseudostateEntryPointEditPart)childEditPart).getFigure());
- return true;
- }
- if(childEditPart instanceof PseudostateExitPointEditPart) {
- getBorderedFigure().getBorderItemContainer().remove(((PseudostateExitPointEditPart)childEditPart).getFigure());
- return true;
- }
- if(childEditPart instanceof ConnectionPointReferenceEditPart) {
- getBorderedFigure().getBorderItemContainer().remove(((ConnectionPointReferenceEditPart)childEditPart).getFigure());
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- protected void setForegroundColor(Color color) {
- if(primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineType(int style) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineWidth(int width) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineWidth(width);
- }
- }
-
- /**
- * 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(IFigure nodeShape) {
- if(nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/StateMachineCompartmentEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/StateMachineCompartmentEditPart.java
deleted file mode 100644
index 101569eb42c..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/StateMachineCompartmentEditPart.java
+++ /dev/null
@@ -1,120 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.CreationEditPolicy;
-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.diagram.common.editpolicies.DuplicatePasteEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateMachineCompartmentXYLayoutEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateMachineDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.RemoveOrphanViewPolicy;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.StateMachineCompartmentItemSemanticEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.Messages;
-
-/**
- * @generated
- */
-public class StateMachineCompartmentEditPart
-
-extends ShapeCompartmentEditPart
-
-{
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 2002;
-
- /**
- * @generated
- */
- public StateMachineCompartmentEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new StateMachineCompartmentItemSemanticEditPolicy());
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
- installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
-
- //in Papyrus diagrams are not strongly synchronised
- //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.diagram.statemachine.edit.policies.StateMachineCompartmentCanonicalEditPolicy());
-
- installEditPolicy("RemoveOrphanView", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
- installEditPolicy(EditPolicy.LAYOUT_ROLE, new CustomStateMachineCompartmentXYLayoutEditPolicy());
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomStateMachineDiagramDragDropEditPolicy());
- }
-
- /**
- * @generated
- */
- public IFigure createFigure() {
- ResizableCompartmentFigure result = (ResizableCompartmentFigure)super.createFigure();
- result.setTitleVisibility(false);
- return result;
- }
-
- /**
- * @generated
- */
- public String getCompartmentName() {
- return Messages.StateMachineCompartmentEditPart_title;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification notification) {
- 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() {
- int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- Dimension size = new Dimension(width, height);
- int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- Point loc = new Point(x, y);
- ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshBounds();
- }
-
- /**
- * @generated
- */
- protected void setRatio(Double ratio) {
- if(getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
- super.setRatio(ratio);
- }
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/StateMachineEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/StateMachineEditPart.java
deleted file mode 100644
index 3094330e101..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/StateMachineEditPart.java
+++ /dev/null
@@ -1,429 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
-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.IBorderItemLocator;
-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.diagram.common.editparts.NamedElementEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AffixedNodeAlignmentEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.BorderItemResizableEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
-import org.eclipse.papyrus.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.StateMachineFigure;
-import org.eclipse.papyrus.diagram.statemachine.custom.locators.CustomEntryExitPointPositionLocator;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateMachineDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomStateMachineLayoutEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.StateMachineItemSemanticEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class StateMachineEditPart extends
-
-NamedElementEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 2000;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public StateMachineEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addChildVisual(EditPart childEditPart, int index) {
- if(addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if(childEditPart instanceof StateMachineNameEditPart) {
- ((StateMachineNameEditPart)childEditPart).setLabel(getPrimaryShape().getNameLabel());
- return true;
- }
-
- if(childEditPart instanceof StateMachineCompartmentEditPart) {
- IFigure pane = getPrimaryShape().getStateMachineCompartmentFigure();
- setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
- pane.add(((StateMachineCompartmentEditPart)childEditPart).getFigure());
- return true;
- }
-
- //Papyrus Gencode :Affixed EntryExitPoints ConnectionPointReferences Locator
- if(childEditPart instanceof PseudostateEntryPointEditPart) {
- IBorderItemLocator locator = new CustomEntryExitPointPositionLocator(getMainFigure(), PositionConstants.NONE);
- getBorderedFigure().getBorderItemContainer().add(((PseudostateEntryPointEditPart)childEditPart).getFigure(), locator);
- return true;
- }
-
- //Papyrus Gencode :Affixed EntryExitPoints ConnectionPointReferences Locator
- if(childEditPart instanceof PseudostateExitPointEditPart) {
- IBorderItemLocator locator = new CustomEntryExitPointPositionLocator(getMainFigure(), PositionConstants.NONE);
- getBorderedFigure().getBorderItemContainer().add(((PseudostateExitPointEditPart)childEditPart).getFigure(), locator);
- return true;
- }
-
- return false;
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new StateMachineItemSemanticEditPolicy());
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
-
- //in Papyrus diagrams are not strongly synchronised
- //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.diagram.statemachine.edit.policies.StateMachineCanonicalEditPolicy());
-
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy(AffixedNodeAlignmentEditPolicy.AFFIXED_CHILD_ALIGNMENT_ROLE, new AffixedNodeAlignmentEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, new CustomStateMachineLayoutEditPolicy());
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomStateMachineDiagramDragDropEditPolicy());
- installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
- // 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() {
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
-
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View)child.getModel();
- switch(UMLVisualIDRegistry.getVisualID(childView)) {
- case PseudostateEntryPointEditPart.VISUAL_ID:
- case PseudostateExitPointEditPart.VISUAL_ID:
-
- return new BorderItemResizableEditPolicy();
-
- }
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * 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
- */
- protected NodeFigure createMainFigure() {
- NodeFigure figure = createNodePlate();
- figure.setLayoutManager(new StackLayout());
- IFigure shape = createNodeShape();
- figure.add(shape);
- contentPane = setupContentPane(shape);
- return figure;
- }
-
- /**
- * @generated
- */
- protected NodeFigure createNodePlate() {
- String prefElementId = "StateMachine";
- IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
- String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
- String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
- DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
-
- return result;
- }
-
- /**
- * @generated
- */
- protected IFigure createNodeShape() {
- return primaryShape = new StateMachineFigure();
- }
-
- /**
- * @generated
- */
- public IFigure getContentPane() {
- if(contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- if(editPart instanceof StateMachineCompartmentEditPart) {
- return getPrimaryShape().getStateMachineCompartmentFigure();
- }
- if(editPart instanceof IBorderItemEditPart) {
- return getBorderedFigure().getBorderItemContainer();
- }
- return getContentPane();
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSource() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Generalization_19000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnSourceAndTarget(IGraphicalEditPart targetEditPart) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(targetEditPart instanceof org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineEditPart) {
- types.add(UMLElementTypes.Generalization_19000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMARelTypesOnTarget() {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Generalization_19000);
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForSource(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Generalization_19000) {
- types.add(UMLElementTypes.StateMachine_2000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- public List<IElementType> getMATypesForTarget(IElementType relationshipType) {
- LinkedList<IElementType> types = new LinkedList<IElementType>();
- if(relationshipType == UMLElementTypes.Generalization_19000) {
- types.add(UMLElementTypes.StateMachine_2000);
- }
- return types;
- }
-
- /**
- * @generated
- */
- @Override
- public Object getPreferredValue(EStructuralFeature feature) {
- 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("StateMachine", PreferenceConstantHelper.COLOR_LINE);
- } else if(feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("StateMachine", PreferenceConstantHelper.COLOR_FONT);
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
- prefColor = PreferenceConstantHelper.getElementConstant("StateMachine", PreferenceConstantHelper.COLOR_FILL);
- }
- result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor((IPreferenceStore)preferenceStore, prefColor));
- } else if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
- String prefGradient = PreferenceConstantHelper.getElementConstant("StateMachine", PreferenceConstantHelper.COLOR_GRADIENT);
- 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;
- }
-
- /**
- * @generated
- */
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(StateMachineNameEditPart.VISUAL_ID));
- }
-
- /**
- * @generated
- */
- public StateMachineFigure getPrimaryShape() {
- return (StateMachineFigure)primaryShape;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- protected void removeChildVisual(EditPart childEditPart) {
- if(removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if(childEditPart instanceof StateMachineNameEditPart) {
- return true;
- }
- if(childEditPart instanceof StateMachineCompartmentEditPart) {
- IFigure pane = getPrimaryShape().getStateMachineCompartmentFigure();
- setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
- pane.remove(((StateMachineCompartmentEditPart)childEditPart).getFigure());
- return true;
- }
- if(childEditPart instanceof PseudostateEntryPointEditPart) {
- getBorderedFigure().getBorderItemContainer().remove(((PseudostateEntryPointEditPart)childEditPart).getFigure());
- return true;
- }
- if(childEditPart instanceof PseudostateExitPointEditPart) {
- getBorderedFigure().getBorderItemContainer().remove(((PseudostateExitPointEditPart)childEditPart).getFigure());
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- protected void setForegroundColor(Color color) {
- if(primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineType(int style) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- protected void setLineWidth(int width) {
- if(primaryShape instanceof Shape) {
- ((Shape)primaryShape).setLineWidth(width);
- }
- }
-
- /**
- * 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(IFigure nodeShape) {
- if(nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/StateMachineNameEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/StateMachineNameEditPart.java
deleted file mode 100644
index e74507aba13..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/StateMachineNameEditPart.java
+++ /dev/null
@@ -1,745 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class StateMachineNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 2001;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /** direct edition mode (default, undefined, registered editor, etc.) */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /** configuration from a registered edit dialog */
- protected IDirectEditorConfiguration configuration;
-
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- public StateMachineNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); //$NON-NLS-1$
-
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- 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 PackageEditPart.NodeLabelDragPolicy());
- }
-
- /**
- * @generated
- */
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return (View)getModel();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.StateMachine_2000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- refreshLabel();
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
-
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- */
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(WrappingLabel figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/StateNameEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/StateNameEditPart.java
deleted file mode 100644
index c9e154807e0..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/StateNameEditPart.java
+++ /dev/null
@@ -1,761 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.NavigationEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class StateNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 6001;
-
- /**
- * @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
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- public StateNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View)getParent().getModel())); //$NON-NLS-1$
-
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- 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 PackageEditPart.NodeLabelDragPolicy());
- installEditPolicy(NavigationEditPolicy.NAVIGATION_POLICY, new NavigationEditPolicy());
- }
-
- /**
- * @generated
- */
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return (View)getModel();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.State_6000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.StateNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- refreshLabel();
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
-
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(WrappingLabel figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/TransitionEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/TransitionEditPart.java
deleted file mode 100644
index d0e9825dcc8..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/TransitionEditPart.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.diagram.common.editparts.UMLConnectionNodeEditPart;
-import org.eclipse.papyrus.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.NavigationEditPolicy;
-import org.eclipse.papyrus.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.custom.figures.TransitionFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.TransitionItemSemanticEditPolicy;
-
-/**
- * @generated
- */
-public class TransitionEditPart extends UMLConnectionNodeEditPart
-
-implements ITreeBranchEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 7000;
-
- /**
- * @generated
- */
- public TransitionEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addChildVisual(EditPart childEditPart, int index) {
- if(addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if(childEditPart instanceof TransitionStereotypeEditPart) {
- ((TransitionStereotypeEditPart)childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
- return true;
- }
- return false;
- }
-
- /**
- * 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
- */
- protected Connection createConnectionFigure() {
- return new TransitionFigure();
- }
-
- /**
- * @generated
- */
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new TransitionItemSemanticEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy(AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy());
- installEditPolicy(NavigationEditPolicy.NAVIGATION_POLICY, new NavigationEditPolicy());
- }
-
- /**
- * @generated
- */
- public TransitionFigure getPrimaryShape() {
- return (TransitionFigure)getFigure();
- }
-
- /**
- * @generated
- */
- protected void removeChildVisual(EditPart childEditPart) {
- if(removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if(childEditPart instanceof TransitionStereotypeEditPart) {
- return true;
- }
- return false;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/TransitionGuardEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/TransitionGuardEditPart.java
deleted file mode 100644
index 270deb606f0..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/TransitionGuardEditPart.java
+++ /dev/null
@@ -1,727 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.editparts.LabelEditPart;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class TransitionGuardEditPart extends LabelEditPart implements ITextAwareEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 7002;
-
- /**
- * @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.diagram.statemachine.edit.parts.TransitionGuardEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public TransitionGuardEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- 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 PackageEditPart.LinkLabelDragPolicy());
- }
-
- /**
- * @generated
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new WrappingLabel();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- public int getKeyPoint() {
- return ConnectionLocator.MIDDLE;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Transition_7000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionGuardEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
-
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/TransitionNameEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/TransitionNameEditPart.java
deleted file mode 100644
index 59168227b72..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/TransitionNameEditPart.java
+++ /dev/null
@@ -1,727 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.editparts.LabelEditPart;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class TransitionNameEditPart extends LabelEditPart implements ITextAwareEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 7001;
-
- /**
- * @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.diagram.statemachine.edit.parts.TransitionNameEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public TransitionNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- 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 PackageEditPart.LinkLabelDragPolicy());
- }
-
- /**
- * @generated
- */
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new WrappingLabel();
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.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;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- public int getKeyPoint() {
- return ConnectionLocator.MIDDLE;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Transition_7000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
-
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(IFigure figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/TransitionStereotypeEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/TransitionStereotypeEditPart.java
deleted file mode 100644
index 568363c6a25..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/TransitionStereotypeEditPart.java
+++ /dev/null
@@ -1,710 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.ParserEditStatus;
-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.editparts.LabelEditPart;
-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.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.diagram.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.diagram.statemachine.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-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.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;
-
-/**
- * @generated
- */
-public class TransitionStereotypeEditPart extends LabelEditPart implements ITextAwareEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 7003;
-
- /**
- * @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.diagram.statemachine.edit.parts.TransitionStereotypeEditPart.VISUAL_ID), new Point(0, 60));
- }
-
- /**
- * @generated
- */
- public TransitionStereotypeEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- protected void addSemanticListeners() {
- if(getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
- for(int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- 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 PackageEditPart.LinkLabelDragPolicy());
- }
-
- /**
- * @generated
- */
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- protected AccessibleEditPart getAccessibleEditPart() {
- if(accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public IContentAssistProcessor getCompletionProcessor() {
- if(getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * 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.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- // The label is read-only (defined in GMFGen model)
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * @generated
- */
- public String getEditText() {
- if(getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- /**
- * @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 {
- IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
- }
- });
- return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * @generated
- */
- public int getKeyPoint() {
- return ConnectionLocator.MIDDLE;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @generated
- */
- protected Image getLabelIconHelper(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 String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if(parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
- }
- if(text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- /**
- * @generated
- */
- protected String getLabelTextHelper(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 DirectEditManager getManager() {
- if(manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected List getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public IParser getParser() {
- if(parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Transition_7000, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionStereotypeEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- protected void handleNotificationEvent(Notification event) {
- Object feature = event.getFeature();
- if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- 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) {
- ISemanticParser modelParser = (ISemanticParser)getParser();
- if(modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if(resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
-
- super.handleNotificationEvent(event);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if(configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return false;
- }
-
- /**
- * 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- getManager().show();
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if(getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch(directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if(configuration == null || configuration.getLanguage() == null) {
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if(configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- } else if(configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if(configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- 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) {
- Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest)theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void refreshFont() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null) {
- FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if(maskLabelPolicy == null) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshUnderline() {
- FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
- if(style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void removeSemanticListeners() {
- if(parserElements != null) {
- for(int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- public void setLabel(WrappingLabel figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- protected void setLabelIconHelper(IFigure figure, 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 setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void setLabelTextHelper(IFigure figure, 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 void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * Updates the preference configuration
- *
- * @generated
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/UMLEditPartFactory.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/UMLEditPartFactory.java
deleted file mode 100644
index fa1965ab65d..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/parts/UMLEditPartFactory.java
+++ /dev/null
@@ -1,338 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.parts;
-
-import org.eclipse.draw2d.FigureUtilities;
-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.jface.viewers.CellEditor;
-import org.eclipse.papyrus.diagram.common.figure.node.IMultilineEditableFigure;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * @generated
- */
-public class UMLEditPartFactory implements EditPartFactory {
-
- /**
- * @generated
- */
- private static class LabelCellEditorLocator implements CellEditorLocator {
-
- /**
- * @generated
- */
- private Label label;
-
- /**
- * @generated
- */
- public LabelCellEditorLocator(Label label) {
- this.label = label;
- }
-
- /**
- * @generated
- */
- public Label getLabel() {
- return label;
- }
-
- /**
- * @generated
- */
- public void relocate(CellEditor celleditor) {
- Text text = (Text)celleditor.getControl();
- Rectangle rect = getLabel().getTextBounds().getCopy();
- getLabel().translateToAbsolute(rect);
- if(!text.getFont().isDisposed()) {
- int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
- rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));
- }
- if(!rect.equals(new Rectangle(text.getBounds()))) {
- text.setBounds(rect.x, rect.y, rect.width, rect.height);
- }
- }
- }
-
- /**
- * @generated
- */
- static private class MultilineCellEditorLocator implements CellEditorLocator {
-
- /**
- * @generated
- */
- private IMultilineEditableFigure multilineEditableFigure;
-
- /**
- * @generated
- */
- public MultilineCellEditorLocator(IMultilineEditableFigure figure) {
- this.multilineEditableFigure = figure;
- }
-
- /**
- * @generated
- */
- public IMultilineEditableFigure getMultilineEditableFigure() {
- return multilineEditableFigure;
- }
-
- /**
- * @generated
- */
- public void relocate(CellEditor celleditor) {
- Text text = (Text)celleditor.getControl();
- 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);
- }
- }
- }
-
- /**
- * @generated
- */
- static private class TextCellEditorLocator implements CellEditorLocator {
-
- /**
- * @generated
- */
- private WrappingLabel wrapLabel;
-
- /**
- * @generated
- */
- public TextCellEditorLocator(WrappingLabel wrapLabel) {
- this.wrapLabel = wrapLabel;
- }
-
- /**
- * @generated
- */
- public WrappingLabel getWrapLabel() {
- return wrapLabel;
- }
-
- /**
- * @generated
- */
- public void relocate(CellEditor celleditor) {
- Text text = (Text)celleditor.getControl();
- Rectangle rect = getWrapLabel().getTextBounds().getCopy();
- getWrapLabel().translateToAbsolute(rect);
- if(!text.getFont().isDisposed()) {
- if(getWrapLabel().isTextWrapOn() && getWrapLabel().getText().length() > 0) {
- rect.setSize(new Dimension(text.computeSize(rect.width, SWT.DEFAULT)));
- } else {
- int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
- rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));
- }
- }
- if(!rect.equals(new Rectangle(text.getBounds()))) {
- text.setBounds(rect.x, rect.y, rect.width, rect.height);
- }
- }
- }
-
- /**
- * @generated
- */
- public static CellEditorLocator getTextCellEditorLocator(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 {
- return new LabelCellEditorLocator((Label)source.getFigure());
- }
- }
-
- /**
- * @generated
- */
- public EditPart createEditPart(EditPart context, Object model) {
- if(model instanceof View) {
- View view = (View)model;
- switch(UMLVisualIDRegistry.getVisualID(view)) {
-
- case PackageEditPart.VISUAL_ID:
- return new PackageEditPart(view);
-
- case StateMachineEditPart.VISUAL_ID:
- return new StateMachineEditPart(view);
-
- case StateMachineNameEditPart.VISUAL_ID:
- return new StateMachineNameEditPart(view);
-
- case RegionEditPart.VISUAL_ID:
- return new RegionEditPart(view);
-
- case FinalStateEditPart.VISUAL_ID:
- return new FinalStateEditPart(view);
-
- case FinalStateNameEditPart.VISUAL_ID:
- return new FinalStateNameEditPart(view);
-
- case FinalStateStereotypeEditPart.VISUAL_ID:
- return new FinalStateStereotypeEditPart(view);
-
- case StateEditPart.VISUAL_ID:
- return new StateEditPart(view);
-
- case StateNameEditPart.VISUAL_ID:
- return new StateNameEditPart(view);
-
- case PseudostateInitialEditPart.VISUAL_ID:
- return new PseudostateInitialEditPart(view);
-
- case PseudostateInitialNameEditPart.VISUAL_ID:
- return new PseudostateInitialNameEditPart(view);
-
- case PseudostateInitialStereotypeEditPart.VISUAL_ID:
- return new PseudostateInitialStereotypeEditPart(view);
-
- case PseudostateJoinEditPart.VISUAL_ID:
- return new PseudostateJoinEditPart(view);
-
- case PseudostateJoinNameEditPart.VISUAL_ID:
- return new PseudostateJoinNameEditPart(view);
-
- case PseudostateJoinStereotypeEditPart.VISUAL_ID:
- return new PseudostateJoinStereotypeEditPart(view);
-
- case PseudostateForkEditPart.VISUAL_ID:
- return new PseudostateForkEditPart(view);
-
- case PseudostateForkNameEditPart.VISUAL_ID:
- return new PseudostateForkNameEditPart(view);
-
- case PseudostateForkStereotypeEditPart.VISUAL_ID:
- return new PseudostateForkStereotypeEditPart(view);
-
- case PseudostateChoiceEditPart.VISUAL_ID:
- return new PseudostateChoiceEditPart(view);
-
- case PseudostateChoiceNameEditPart.VISUAL_ID:
- return new PseudostateChoiceNameEditPart(view);
-
- case PseudostateChoiceStereotypeEditPart.VISUAL_ID:
- return new PseudostateChoiceStereotypeEditPart(view);
-
- case PseudostateJunctionEditPart.VISUAL_ID:
- return new PseudostateJunctionEditPart(view);
-
- case PseudostateJunctionNameEditPart.VISUAL_ID:
- return new PseudostateJunctionNameEditPart(view);
-
- case PseudostateJunctionStereotypeEditPart.VISUAL_ID:
- return new PseudostateJunctionStereotypeEditPart(view);
-
- case PseudostateShallowHistoryEditPart.VISUAL_ID:
- return new PseudostateShallowHistoryEditPart(view);
-
- case PseudostateShallowHistoryNameEditPart.VISUAL_ID:
- return new PseudostateShallowHistoryNameEditPart(view);
-
- case PseudostateShallowHistoryStereotypeEditPart.VISUAL_ID:
- return new PseudostateShallowHistoryStereotypeEditPart(view);
-
- case PseudostateDeepHistoryEditPart.VISUAL_ID:
- return new PseudostateDeepHistoryEditPart(view);
-
- case PseudostateDeepHistoryNameEditPart.VISUAL_ID:
- return new PseudostateDeepHistoryNameEditPart(view);
-
- case PseudostateDeepHistoryStereotypeEditPart.VISUAL_ID:
- return new PseudostateDeepHistoryStereotypeEditPart(view);
-
- case PseudostateTerminateEditPart.VISUAL_ID:
- return new PseudostateTerminateEditPart(view);
-
- case PseudostateTerminateNameEditPart.VISUAL_ID:
- return new PseudostateTerminateNameEditPart(view);
-
- case PseudostateTerminateStereotypeEditPart.VISUAL_ID:
- return new PseudostateTerminateStereotypeEditPart(view);
-
- case PseudostateEntryPointEditPart.VISUAL_ID:
- return new PseudostateEntryPointEditPart(view);
-
- case PseudostateEntryPointNameEditPart.VISUAL_ID:
- return new PseudostateEntryPointNameEditPart(view);
-
- case PseudostateEntryPointStereotypeEditPart.VISUAL_ID:
- return new PseudostateEntryPointStereotypeEditPart(view);
-
- case PseudostateExitPointEditPart.VISUAL_ID:
- return new PseudostateExitPointEditPart(view);
-
- case PseudostateExitPointNameEditPart.VISUAL_ID:
- return new PseudostateExitPointNameEditPart(view);
-
- case PseudostateExitPointStereotypeEditPart.VISUAL_ID:
- return new PseudostateExitPointStereotypeEditPart(view);
-
- case ConnectionPointReferenceEditPart.VISUAL_ID:
- return new ConnectionPointReferenceEditPart(view);
-
- case ConnectionPointReferenceNameEditPart.VISUAL_ID:
- return new ConnectionPointReferenceNameEditPart(view);
-
- case ConnectionPointReferenceStereotypeEditPart.VISUAL_ID:
- return new ConnectionPointReferenceStereotypeEditPart(view);
-
- case RegionCompartmentEditPart.VISUAL_ID:
- return new RegionCompartmentEditPart(view);
-
- case StateMachineCompartmentEditPart.VISUAL_ID:
- return new StateMachineCompartmentEditPart(view);
-
- case StateCompartmentEditPart.VISUAL_ID:
- return new StateCompartmentEditPart(view);
-
- case TransitionEditPart.VISUAL_ID:
- return new TransitionEditPart(view);
-
- case TransitionNameEditPart.VISUAL_ID:
- return new TransitionNameEditPart(view);
-
- case TransitionGuardEditPart.VISUAL_ID:
- return new TransitionGuardEditPart(view);
-
- case TransitionStereotypeEditPart.VISUAL_ID:
- return new TransitionStereotypeEditPart(view);
-
- case GeneralizationEditPart.VISUAL_ID:
- return new GeneralizationEditPart(view);
-
- case GeneralizationStereotypeEditPart.VISUAL_ID:
- return new GeneralizationStereotypeEditPart(view);
-
- }
- }
- return createUnrecognizedEditPart(context, model);
- }
-
- /**
- * @generated
- */
- private EditPart createUnrecognizedEditPart(EditPart context, Object model) {
- // Handle creation of unrecognized child node EditParts here
- return null;
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/ConnectionPointReferenceItemSemanticEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/ConnectionPointReferenceItemSemanticEditPolicy.java
deleted file mode 100644
index 19a2d30b4bb..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/ConnectionPointReferenceItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.command.DeleteCommand;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-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.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionReorientCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class ConnectionPointReferenceItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public ConnectionPointReferenceItemSemanticEditPolicy() {
- super(UMLElementTypes.ConnectionPointReference_18000);
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- View view = (View)getHost().getModel();
- CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(true);
-
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if(annotation == null) {
- // there are indirectly referenced children, need extra commands: false
- addDestroyShortcutsCommand(cmd, view);
- // delete host element
- List<EObject> todestroy = new ArrayList<EObject>();
- todestroy.add(req.getElementToDestroy());
- //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- cmd.add(new EMFtoGMFCommandWrapper(new DeleteCommand(getEditingDomain(), todestroy)));
- } else {
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch(getVisualID(req)) {
- case TransitionEditPart.VISUAL_ID:
- return getGEFWrapper(new TransitionReorientCommand(req));
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/FinalStateItemSemanticEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/FinalStateItemSemanticEditPolicy.java
deleted file mode 100644
index bb5f1f28460..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/FinalStateItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-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.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionReorientCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class FinalStateItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public FinalStateItemSemanticEditPolicy() {
- super(UMLElementTypes.FinalState_5000);
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- View view = (View)getHost().getModel();
- CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(true);
-
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if(annotation == null) {
- // there are indirectly referenced children, need extra commands: false
- addDestroyShortcutsCommand(cmd, view);
- // delete host element
- List<EObject> todestroy = new ArrayList<EObject>();
- todestroy.add(req.getElementToDestroy());
- //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- cmd.add(new EMFtoGMFCommandWrapper(new org.eclipse.emf.edit.command.DeleteCommand(getEditingDomain(), todestroy)));
- } else {
- cmd.add(new DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch(getVisualID(req)) {
- case TransitionEditPart.VISUAL_ID:
- return getGEFWrapper(new TransitionReorientCommand(req));
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/GeneralizationItemSemanticEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/GeneralizationItemSemanticEditPolicy.java
deleted file mode 100644
index 623ce7f290e..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/GeneralizationItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.command.DeleteCommand;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class GeneralizationItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public GeneralizationItemSemanticEditPolicy() {
- super(UMLElementTypes.Generalization_19000);
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(true);
- List<EObject> todestroy = new ArrayList<EObject>();
- todestroy.add(req.getElementToDestroy());
- //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- cmd.add(new EMFtoGMFCommandWrapper(new DeleteCommand(getEditingDomain(), todestroy)));
- return getGEFWrapper(cmd.reduce());
- //return getGEFWrapper(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PackageCanonicalEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PackageCanonicalEditPolicy.java
deleted file mode 100644
index 38bc311e605..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PackageCanonicalEditPolicy.java
+++ /dev/null
@@ -1,469 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import java.util.ArrayList;
-import java.util.Collection;
-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.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SetViewMutabilityCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-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.diagram.statemachine.edit.parts.ConnectionPointReferenceEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.FinalStateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateChoiceEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateDeepHistoryEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateForkEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateInitialEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJoinEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJunctionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateShallowHistoryEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateTerminateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramUpdater;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLLinkDescriptor;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLNodeDescriptor;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class PackageCanonicalEditPolicy extends CanonicalEditPolicy {
-
- /**
- * @generated
- */
- protected void refreshOnActivate() {
- // Need to activate editpart children before invoking the canonical refresh for EditParts to add event listeners
- List<?> c = getHost().getChildren();
- for(int i = 0; i < c.size(); i++) {
- ((EditPart)c.get(i)).activate();
- }
- super.refreshOnActivate();
- }
-
- /**
- * @generated
- */
- private Collection<UMLLinkDescriptor> collectAllLinks(View view, Map<EObject, View> domain2NotationMap) {
- if(!PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view))) {
- return Collections.emptyList();
- }
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- switch(UMLVisualIDRegistry.getVisualID(view)) {
- case PackageEditPart.VISUAL_ID:
- {
- if(!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.getPackage_1000ContainedLinks(view));
- }
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
- break;
- }
- case StateMachineEditPart.VISUAL_ID:
- {
- if(!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.getStateMachine_2000ContainedLinks(view));
- }
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
- break;
- }
- case RegionEditPart.VISUAL_ID:
- {
- if(!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.getRegion_3000ContainedLinks(view));
- }
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
- break;
- }
- case FinalStateEditPart.VISUAL_ID:
- {
- if(!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.getFinalState_5000ContainedLinks(view));
- }
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
- break;
- }
- case StateEditPart.VISUAL_ID:
- {
- if(!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.getState_6000ContainedLinks(view));
- }
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
- break;
- }
- case PseudostateInitialEditPart.VISUAL_ID:
- {
- if(!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.getPseudostate_8000ContainedLinks(view));
- }
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
- break;
- }
- case PseudostateJoinEditPart.VISUAL_ID:
- {
- if(!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.getPseudostate_9000ContainedLinks(view));
- }
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
- break;
- }
- case PseudostateForkEditPart.VISUAL_ID:
- {
- if(!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.getPseudostate_10000ContainedLinks(view));
- }
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
- break;
- }
- case PseudostateChoiceEditPart.VISUAL_ID:
- {
- if(!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.getPseudostate_11000ContainedLinks(view));
- }
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
- break;
- }
- case PseudostateJunctionEditPart.VISUAL_ID:
- {
- if(!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.getPseudostate_12000ContainedLinks(view));
- }
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
- break;
- }
- case PseudostateShallowHistoryEditPart.VISUAL_ID:
- {
- if(!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.getPseudostate_13000ContainedLinks(view));
- }
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
- break;
- }
- case PseudostateDeepHistoryEditPart.VISUAL_ID:
- {
- if(!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.getPseudostate_14000ContainedLinks(view));
- }
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
- break;
- }
- case PseudostateTerminateEditPart.VISUAL_ID:
- {
- if(!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.getPseudostate_15000ContainedLinks(view));
- }
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
- break;
- }
- case PseudostateEntryPointEditPart.VISUAL_ID:
- {
- if(!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.getPseudostate_16000ContainedLinks(view));
- }
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
- break;
- }
- case PseudostateExitPointEditPart.VISUAL_ID:
- {
- if(!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.getPseudostate_17000ContainedLinks(view));
- }
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
- break;
- }
- case ConnectionPointReferenceEditPart.VISUAL_ID:
- {
- if(!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.getConnectionPointReference_18000ContainedLinks(view));
- }
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
- break;
- }
- case TransitionEditPart.VISUAL_ID:
- {
- if(!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.getTransition_7000ContainedLinks(view));
- }
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
- break;
- }
- case GeneralizationEditPart.VISUAL_ID:
- {
- if(!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.getGeneralization_19000ContainedLinks(view));
- }
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
- break;
- }
- }
- for(Iterator children = view.getChildren().iterator(); children.hasNext();) {
- result.addAll(collectAllLinks((View)children.next(), domain2NotationMap));
- }
- for(Iterator edges = view.getSourceEdges().iterator(); edges.hasNext();) {
- result.addAll(collectAllLinks((View)edges.next(), domain2NotationMap));
- }
- return result;
- }
-
- /**
- * @generated
- */
- private Collection<IAdaptable> createConnections(Collection<UMLLinkDescriptor> linkDescriptors, Map<EObject, View> domain2NotationMap) {
- LinkedList<IAdaptable> adapters = new LinkedList<IAdaptable>();
- for(UMLLinkDescriptor nextLinkDescriptor : linkDescriptors) {
- EditPart sourceEditPart = getEditPart(nextLinkDescriptor.getSource(), domain2NotationMap);
- EditPart targetEditPart = getEditPart(nextLinkDescriptor.getDestination(), domain2NotationMap);
- if(sourceEditPart == null || targetEditPart == null) {
- continue;
- }
- CreateConnectionViewRequest.ConnectionViewDescriptor descriptor = new CreateConnectionViewRequest.ConnectionViewDescriptor(nextLinkDescriptor.getSemanticAdapter(), UMLVisualIDRegistry.getType(nextLinkDescriptor.getVisualID()), ViewUtil.APPEND, false, ((IGraphicalEditPart)getHost()).getDiagramPreferencesHint());
- CreateConnectionViewRequest ccr = new CreateConnectionViewRequest(descriptor);
- ccr.setType(RequestConstants.REQ_CONNECTION_START);
- ccr.setSourceEditPart(sourceEditPart);
- sourceEditPart.getCommand(ccr);
- ccr.setTargetEditPart(targetEditPart);
- ccr.setType(RequestConstants.REQ_CONNECTION_END);
- Command cmd = targetEditPart.getCommand(ccr);
- if(cmd != null && cmd.canExecute()) {
- executeCommand(cmd);
- IAdaptable viewAdapter = (IAdaptable)ccr.getNewObject();
- if(viewAdapter != null) {
- adapters.add(viewAdapter);
- }
- }
- }
- return adapters;
- }
-
- /**
- * @generated
- */
- private Diagram getDiagram() {
- return ((View)getHost().getModel()).getDiagram();
- }
-
- /**
- * @generated
- */
- private EditPart getEditPart(EObject domainModelElement, Map<EObject, View> domain2NotationMap) {
- View view = (View)domain2NotationMap.get(domainModelElement);
- if(view != null) {
- return (EditPart)getHost().getViewer().getEditPartRegistry().get(view);
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected EStructuralFeature getFeatureToSynchronize() {
- return UMLPackage.eINSTANCE.getPackage_PackagedElement();
- }
-
- /**
- * @generated
- */
- @SuppressWarnings("rawtypes")
- protected List getSemanticChildrenList() {
- View viewObject = (View)getHost().getModel();
- LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.getPackage_1000SemanticChildren(viewObject);
- for(UMLNodeDescriptor d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- }
-
- /**
- * @generated
- */
- private boolean isMyDiagramElement(View view) {
- return StateMachineEditPart.VISUAL_ID == UMLVisualIDRegistry.getVisualID(view);
- }
-
- /**
- * @generated
- */
- protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) {
- return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement());
- }
-
- /**
- * @generated
- */
- private Collection<IAdaptable> refreshConnections() {
- Map<EObject, View> domain2NotationMap = new HashMap<EObject, View>();
- Collection<UMLLinkDescriptor> linkDescriptors = collectAllLinks(getDiagram(), domain2NotationMap);
- Collection existingLinks = new LinkedList(getDiagram().getEdges());
- for(Iterator linksIterator = existingLinks.iterator(); linksIterator.hasNext();) {
- Edge nextDiagramLink = (Edge)linksIterator.next();
- int diagramLinkVisualID = UMLVisualIDRegistry.getVisualID(nextDiagramLink);
- if(diagramLinkVisualID == -1) {
- if(nextDiagramLink.getSource() != null && nextDiagramLink.getTarget() != null) {
- linksIterator.remove();
- }
- continue;
- }
- EObject diagramLinkObject = nextDiagramLink.getElement();
- EObject diagramLinkSrc = nextDiagramLink.getSource().getElement();
- EObject diagramLinkDst = nextDiagramLink.getTarget().getElement();
- for(Iterator<UMLLinkDescriptor> linkDescriptorsIterator = linkDescriptors.iterator(); linkDescriptorsIterator.hasNext();) {
- UMLLinkDescriptor nextLinkDescriptor = linkDescriptorsIterator.next();
- if(diagramLinkObject == nextLinkDescriptor.getModelElement() && diagramLinkSrc == nextLinkDescriptor.getSource() && diagramLinkDst == nextLinkDescriptor.getDestination() && diagramLinkVisualID == nextLinkDescriptor.getVisualID()) {
- linksIterator.remove();
- linkDescriptorsIterator.remove();
- break;
- }
- }
- }
- deleteViews(existingLinks.iterator());
- return createConnections(linkDescriptors, domain2NotationMap);
- }
-
- /**
- * @generated
- */
- protected void refreshSemantic() {
- if(resolveSemanticElement() == null) {
- return;
- }
- LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.getPackage_1000SemanticChildren((View)getHost().getModel());
- LinkedList<View> orphaned = new LinkedList<View>();
- // we care to check only views we recognize as ours
- LinkedList<View> knownViewChildren = new LinkedList<View>();
- for(View v : getViewChildren()) {
- if(isMyDiagramElement(v)) {
- knownViewChildren.add(v);
- }
- }
- // alternative to #cleanCanonicalSemanticChildren(getViewChildren(), semanticChildren)
- //
- // iteration happens over list of desired semantic elements, trying to find best matching View, while original CEP
- // iterates views, potentially losing view (size/bounds) information - i.e. if there are few views to reference same EObject, only last one
- // to answer isOrphaned == true will be used for the domain element representation, see #cleanCanonicalSemanticChildren()
- for(Iterator<UMLNodeDescriptor> descriptorsIterator = childDescriptors.iterator(); descriptorsIterator.hasNext();) {
- UMLNodeDescriptor next = descriptorsIterator.next();
- String hint = UMLVisualIDRegistry.getType(next.getVisualID());
- LinkedList<View> perfectMatch = new LinkedList<View>(); // both semanticElement and hint match that of NodeDescriptor
- for(View childView : getViewChildren()) {
- EObject semanticElement = childView.getElement();
- if(next.getModelElement().equals(semanticElement)) {
- if(hint.equals(childView.getType())) {
- perfectMatch.add(childView);
- // actually, can stop iteration over view children here, but
- // may want to use not the first view but last one as a 'real' match (the way original CEP does
- // with its trick with viewToSemanticMap inside #cleanCanonicalSemanticChildren
- }
- }
- }
- if(perfectMatch.size() > 0) {
- descriptorsIterator.remove(); // precise match found no need to create anything for the NodeDescriptor
- // use only one view (first or last?), keep rest as orphaned for further consideration
- knownViewChildren.remove(perfectMatch.getFirst());
- }
- }
- // those left in knownViewChildren are subject to removal - they are our diagram elements we didn't find match to,
- // or those we have potential matches to, and thus need to be recreated, preserving size/location information.
- orphaned.addAll(knownViewChildren);
- //
- ArrayList<CreateViewRequest.ViewDescriptor> viewDescriptors = new ArrayList<CreateViewRequest.ViewDescriptor>(childDescriptors.size());
- for(UMLNodeDescriptor next : childDescriptors) {
- String hint = UMLVisualIDRegistry.getType(next.getVisualID());
- IAdaptable elementAdapter = new CanonicalElementAdapter(next.getModelElement(), hint);
- CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(elementAdapter, Node.class, hint, ViewUtil.APPEND, false, host().getDiagramPreferencesHint());
- viewDescriptors.add(descriptor);
- }
-
- boolean changed = deleteViews(orphaned.iterator());
- //
- CreateViewRequest request = getCreateViewRequest(viewDescriptors);
- Command cmd = getCreateViewCommand(request);
- if(cmd != null && cmd.canExecute()) {
- SetViewMutabilityCommand.makeMutable(new EObjectAdapter(host().getNotationView())).execute();
- executeCommand(cmd);
- @SuppressWarnings("unchecked")
- List<IAdaptable> nl = (List<IAdaptable>)request.getNewObject();
- createdViews.addAll(nl);
- }
- if(changed || createdViews.size() > 0) {
- postProcessRefreshSemantic(createdViews);
- }
-
- Collection<IAdaptable> createdConnectionViews = refreshConnections();
-
- if(createdViews.size() > 1) {
- // perform a layout of the container
- DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
- executeCommand(new ICommandProxy(layoutCmd));
- }
-
- createdViews.addAll(createdConnectionViews);
-
- makeViewsImmutable(createdViews);
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PackageItemSemanticEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PackageItemSemanticEditPolicy.java
deleted file mode 100644
index 073e2b6aa47..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PackageItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.diagram.common.commands.DuplicateNamedElementCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.StateMachineCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class PackageItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- private static class DuplicateAnythingCommand extends DuplicateNamedElementCommand {
-
- private Diagram diagram;
-
- /**
- * @generated
- */
- public DuplicateAnythingCommand(TransactionalEditingDomain editingDomain, DuplicateElementsRequest req, Diagram currentDiagram) {
- super(editingDomain, req.getLabel(), req.getElementsToBeDuplicated(), req.getAllDuplicatedElementsMap(), currentDiagram);
- this.diagram = currentDiagram;
- }
- }
-
- /**
- * @generated
- */
- public PackageItemSemanticEditPolicy() {
- super(UMLElementTypes.Package_1000);
- }
-
- /**
- * @generated
- */
- protected Command getCreateCommand(CreateElementRequest req) {
- if(UMLElementTypes.StateMachine_2000 == req.getElementType()) {
- return getGEFWrapper(new StateMachineCreateCommand(req));
- }
- return super.getCreateCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getDuplicateCommand(DuplicateElementsRequest req) {
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
- Diagram currentDiagram = null;
- if(getHost() instanceof IGraphicalEditPart) {
- currentDiagram = ((IGraphicalEditPart)getHost()).getNotationView().getDiagram();
- }
- return getGEFWrapper(new DuplicateAnythingCommand(editingDomain, req, currentDiagram));
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateChoiceItemSemanticEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateChoiceItemSemanticEditPolicy.java
deleted file mode 100644
index 964bcb8d86c..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateChoiceItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.command.DeleteCommand;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-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.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionReorientCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class PseudostateChoiceItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public PseudostateChoiceItemSemanticEditPolicy() {
- super(UMLElementTypes.Pseudostate_11000);
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- View view = (View)getHost().getModel();
- CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(true);
-
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if(annotation == null) {
- // there are indirectly referenced children, need extra commands: false
- addDestroyShortcutsCommand(cmd, view);
- // delete host element
- List<EObject> todestroy = new ArrayList<EObject>();
- todestroy.add(req.getElementToDestroy());
- //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- cmd.add(new EMFtoGMFCommandWrapper(new DeleteCommand(getEditingDomain(), todestroy)));
- } else {
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch(getVisualID(req)) {
- case TransitionEditPart.VISUAL_ID:
- return getGEFWrapper(new TransitionReorientCommand(req));
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateDeepHistoryItemSemanticEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateDeepHistoryItemSemanticEditPolicy.java
deleted file mode 100644
index 1f67ca6c19f..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateDeepHistoryItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.command.DeleteCommand;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-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.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionReorientCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class PseudostateDeepHistoryItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public PseudostateDeepHistoryItemSemanticEditPolicy() {
- super(UMLElementTypes.Pseudostate_14000);
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- View view = (View)getHost().getModel();
- CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(true);
-
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if(annotation == null) {
- // there are indirectly referenced children, need extra commands: false
- addDestroyShortcutsCommand(cmd, view);
- // delete host element
- List<EObject> todestroy = new ArrayList<EObject>();
- todestroy.add(req.getElementToDestroy());
- //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- cmd.add(new EMFtoGMFCommandWrapper(new DeleteCommand(getEditingDomain(), todestroy)));
- } else {
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch(getVisualID(req)) {
- case TransitionEditPart.VISUAL_ID:
- return getGEFWrapper(new TransitionReorientCommand(req));
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateEntryPointItemSemanticEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateEntryPointItemSemanticEditPolicy.java
deleted file mode 100644
index d8cf0d40b66..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateEntryPointItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.command.DeleteCommand;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-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.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionReorientCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class PseudostateEntryPointItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public PseudostateEntryPointItemSemanticEditPolicy() {
- super(UMLElementTypes.Pseudostate_16000);
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- View view = (View)getHost().getModel();
- CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(true);
-
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if(annotation == null) {
- // there are indirectly referenced children, need extra commands: false
- addDestroyShortcutsCommand(cmd, view);
- // delete host element
- List<EObject> todestroy = new ArrayList<EObject>();
- todestroy.add(req.getElementToDestroy());
- //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- cmd.add(new EMFtoGMFCommandWrapper(new DeleteCommand(getEditingDomain(), todestroy)));
- } else {
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch(getVisualID(req)) {
- case TransitionEditPart.VISUAL_ID:
- return getGEFWrapper(new TransitionReorientCommand(req));
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateExitPointItemSemanticEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateExitPointItemSemanticEditPolicy.java
deleted file mode 100644
index 67df7fa0180..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateExitPointItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.command.DeleteCommand;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-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.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionReorientCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class PseudostateExitPointItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public PseudostateExitPointItemSemanticEditPolicy() {
- super(UMLElementTypes.Pseudostate_17000);
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- View view = (View)getHost().getModel();
- CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(true);
-
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if(annotation == null) {
- // there are indirectly referenced children, need extra commands: false
- addDestroyShortcutsCommand(cmd, view);
- // delete host element
- List<EObject> todestroy = new ArrayList<EObject>();
- todestroy.add(req.getElementToDestroy());
- //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- cmd.add(new EMFtoGMFCommandWrapper(new DeleteCommand(getEditingDomain(), todestroy)));
- } else {
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch(getVisualID(req)) {
- case TransitionEditPart.VISUAL_ID:
- return getGEFWrapper(new TransitionReorientCommand(req));
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateForkItemSemanticEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateForkItemSemanticEditPolicy.java
deleted file mode 100644
index a2836d2a9ed..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateForkItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.command.DeleteCommand;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-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.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionReorientCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class PseudostateForkItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public PseudostateForkItemSemanticEditPolicy() {
- super(UMLElementTypes.Pseudostate_10000);
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- View view = (View)getHost().getModel();
- CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(true);
-
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if(annotation == null) {
- // there are indirectly referenced children, need extra commands: false
- addDestroyShortcutsCommand(cmd, view);
- // delete host element
- List<EObject> todestroy = new ArrayList<EObject>();
- todestroy.add(req.getElementToDestroy());
- //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- cmd.add(new EMFtoGMFCommandWrapper(new DeleteCommand(getEditingDomain(), todestroy)));
- } else {
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch(getVisualID(req)) {
- case TransitionEditPart.VISUAL_ID:
- return getGEFWrapper(new TransitionReorientCommand(req));
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateInitialItemSemanticEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateInitialItemSemanticEditPolicy.java
deleted file mode 100644
index cbec43d68a4..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateInitialItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.command.DeleteCommand;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-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.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionReorientCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class PseudostateInitialItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public PseudostateInitialItemSemanticEditPolicy() {
- super(UMLElementTypes.Pseudostate_8000);
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- View view = (View)getHost().getModel();
- CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(true);
-
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if(annotation == null) {
- // there are indirectly referenced children, need extra commands: false
- addDestroyShortcutsCommand(cmd, view);
- // delete host element
- List<EObject> todestroy = new ArrayList<EObject>();
- todestroy.add(req.getElementToDestroy());
- //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- cmd.add(new EMFtoGMFCommandWrapper(new DeleteCommand(getEditingDomain(), todestroy)));
- } else {
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch(getVisualID(req)) {
- case TransitionEditPart.VISUAL_ID:
- return getGEFWrapper(new TransitionReorientCommand(req));
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateJoinItemSemanticEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateJoinItemSemanticEditPolicy.java
deleted file mode 100644
index d0b80040d81..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateJoinItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.command.DeleteCommand;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-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.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionReorientCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class PseudostateJoinItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public PseudostateJoinItemSemanticEditPolicy() {
- super(UMLElementTypes.Pseudostate_9000);
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- View view = (View)getHost().getModel();
- CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(true);
-
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if(annotation == null) {
- // there are indirectly referenced children, need extra commands: false
- addDestroyShortcutsCommand(cmd, view);
- // delete host element
- List<EObject> todestroy = new ArrayList<EObject>();
- todestroy.add(req.getElementToDestroy());
- //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- cmd.add(new EMFtoGMFCommandWrapper(new DeleteCommand(getEditingDomain(), todestroy)));
- } else {
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch(getVisualID(req)) {
- case TransitionEditPart.VISUAL_ID:
- return getGEFWrapper(new TransitionReorientCommand(req));
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateJunctionItemSemanticEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateJunctionItemSemanticEditPolicy.java
deleted file mode 100644
index 4552e5420c5..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateJunctionItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.command.DeleteCommand;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-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.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionReorientCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class PseudostateJunctionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public PseudostateJunctionItemSemanticEditPolicy() {
- super(UMLElementTypes.Pseudostate_12000);
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- View view = (View)getHost().getModel();
- CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(true);
-
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if(annotation == null) {
- // there are indirectly referenced children, need extra commands: false
- addDestroyShortcutsCommand(cmd, view);
- // delete host element
- List<EObject> todestroy = new ArrayList<EObject>();
- todestroy.add(req.getElementToDestroy());
- //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- cmd.add(new EMFtoGMFCommandWrapper(new DeleteCommand(getEditingDomain(), todestroy)));
- } else {
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch(getVisualID(req)) {
- case TransitionEditPart.VISUAL_ID:
- return getGEFWrapper(new TransitionReorientCommand(req));
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateShallowHistoryItemSemanticEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateShallowHistoryItemSemanticEditPolicy.java
deleted file mode 100644
index ce4363be92e..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateShallowHistoryItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.command.DeleteCommand;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-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.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionReorientCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class PseudostateShallowHistoryItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public PseudostateShallowHistoryItemSemanticEditPolicy() {
- super(UMLElementTypes.Pseudostate_13000);
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- View view = (View)getHost().getModel();
- CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(true);
-
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if(annotation == null) {
- // there are indirectly referenced children, need extra commands: false
- addDestroyShortcutsCommand(cmd, view);
- // delete host element
- List<EObject> todestroy = new ArrayList<EObject>();
- todestroy.add(req.getElementToDestroy());
- //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- cmd.add(new EMFtoGMFCommandWrapper(new DeleteCommand(getEditingDomain(), todestroy)));
- } else {
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch(getVisualID(req)) {
- case TransitionEditPart.VISUAL_ID:
- return getGEFWrapper(new TransitionReorientCommand(req));
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateTerminateItemSemanticEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateTerminateItemSemanticEditPolicy.java
deleted file mode 100644
index e8301a8cbed..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/PseudostateTerminateItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.command.DeleteCommand;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-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.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionReorientCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class PseudostateTerminateItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public PseudostateTerminateItemSemanticEditPolicy() {
- super(UMLElementTypes.Pseudostate_15000);
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- View view = (View)getHost().getModel();
- CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(true);
-
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if(annotation == null) {
- // there are indirectly referenced children, need extra commands: false
- addDestroyShortcutsCommand(cmd, view);
- // delete host element
- List<EObject> todestroy = new ArrayList<EObject>();
- todestroy.add(req.getElementToDestroy());
- //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- cmd.add(new EMFtoGMFCommandWrapper(new DeleteCommand(getEditingDomain(), todestroy)));
- } else {
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch(getVisualID(req)) {
- case TransitionEditPart.VISUAL_ID:
- return getGEFWrapper(new TransitionReorientCommand(req));
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/RegionCompartmentCanonicalEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/RegionCompartmentCanonicalEditPolicy.java
deleted file mode 100644
index c841c65a2ec..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/RegionCompartmentCanonicalEditPolicy.java
+++ /dev/null
@@ -1,241 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SetViewMutabilityCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.notation.Bounds;
-import org.eclipse.gmf.runtime.notation.Location;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.Size;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.FinalStateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateChoiceEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateDeepHistoryEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateForkEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateInitialEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJoinEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJunctionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateShallowHistoryEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateTerminateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramUpdater;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLNodeDescriptor;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class RegionCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
-
- /**
- * @generated
- */
- private Set<EStructuralFeature> myFeaturesToSynchronize;
-
- /**
- * @generated
- */
- protected void refreshOnActivate() {
- // Need to activate editpart children before invoking the canonical refresh for EditParts to add event listeners
- List<?> c = getHost().getChildren();
- for(int i = 0; i < c.size(); i++) {
- ((EditPart)c.get(i)).activate();
- }
- super.refreshOnActivate();
- }
-
- /**
- * @generated
- */
- protected Set getFeaturesToSynchronize() {
- if(myFeaturesToSynchronize == null) {
- myFeaturesToSynchronize = new HashSet<EStructuralFeature>();
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getRegion_Subvertex());
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getStateMachine_ConnectionPoint());
- }
- return myFeaturesToSynchronize;
- }
-
- /**
- * @generated
- */
- @SuppressWarnings("rawtypes")
- protected List getSemanticChildrenList() {
- View viewObject = (View)getHost().getModel();
- LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.getRegionRegionCompartment_3002SemanticChildren(viewObject);
- for(UMLNodeDescriptor d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- }
-
- /**
- * @generated
- */
- private boolean isMyDiagramElement(View view) {
- int visualID = UMLVisualIDRegistry.getVisualID(view);
- switch(visualID) {
- case PseudostateInitialEditPart.VISUAL_ID:
- case PseudostateJoinEditPart.VISUAL_ID:
- case PseudostateForkEditPart.VISUAL_ID:
- case PseudostateChoiceEditPart.VISUAL_ID:
- case PseudostateJunctionEditPart.VISUAL_ID:
- case PseudostateShallowHistoryEditPart.VISUAL_ID:
- case PseudostateDeepHistoryEditPart.VISUAL_ID:
- case PseudostateTerminateEditPart.VISUAL_ID:
- case FinalStateEditPart.VISUAL_ID:
- case StateEditPart.VISUAL_ID:
- case PseudostateEntryPointEditPart.VISUAL_ID:
- case PseudostateExitPointEditPart.VISUAL_ID:
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) {
- return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement());
- }
-
- /**
- * @generated
- */
- protected void refreshSemantic() {
- if(resolveSemanticElement() == null) {
- return;
- }
- LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.getRegionRegionCompartment_3002SemanticChildren((View)getHost().getModel());
- LinkedList<View> orphaned = new LinkedList<View>();
- // we care to check only views we recognize as ours
- LinkedList<View> knownViewChildren = new LinkedList<View>();
- for(View v : getViewChildren()) {
- if(isMyDiagramElement(v)) {
- knownViewChildren.add(v);
- }
- }
- // alternative to #cleanCanonicalSemanticChildren(getViewChildren(), semanticChildren)
- HashMap<UMLNodeDescriptor, LinkedList<View>> potentialViews = new HashMap<UMLNodeDescriptor, LinkedList<View>>();
- //
- // iteration happens over list of desired semantic elements, trying to find best matching View, while original CEP
- // iterates views, potentially losing view (size/bounds) information - i.e. if there are few views to reference same EObject, only last one
- // to answer isOrphaned == true will be used for the domain element representation, see #cleanCanonicalSemanticChildren()
- for(Iterator<UMLNodeDescriptor> descriptorsIterator = childDescriptors.iterator(); descriptorsIterator.hasNext();) {
- UMLNodeDescriptor next = descriptorsIterator.next();
- String hint = UMLVisualIDRegistry.getType(next.getVisualID());
- LinkedList<View> perfectMatch = new LinkedList<View>(); // both semanticElement and hint match that of NodeDescriptor
- LinkedList<View> potentialMatch = new LinkedList<View>(); // semanticElement matches, hint does not
- for(View childView : getViewChildren()) {
- EObject semanticElement = childView.getElement();
- if(next.getModelElement().equals(semanticElement)) {
- if(hint.equals(childView.getType())) {
- perfectMatch.add(childView);
- // actually, can stop iteration over view children here, but
- // may want to use not the first view but last one as a 'real' match (the way original CEP does
- // with its trick with viewToSemanticMap inside #cleanCanonicalSemanticChildren
- } else {
- potentialMatch.add(childView);
- }
- }
- }
- if(perfectMatch.size() > 0) {
- descriptorsIterator.remove(); // precise match found no need to create anything for the NodeDescriptor
- // use only one view (first or last?), keep rest as orphaned for further consideration
- knownViewChildren.remove(perfectMatch.getFirst());
- } else if(potentialMatch.size() > 0) {
- potentialViews.put(next, potentialMatch);
- }
- }
- // those left in knownViewChildren are subject to removal - they are our diagram elements we didn't find match to,
- // or those we have potential matches to, and thus need to be recreated, preserving size/location information.
- orphaned.addAll(knownViewChildren);
- //
- CompositeTransactionalCommand boundsCommand = new CompositeTransactionalCommand(host().getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize);
- ArrayList<CreateViewRequest.ViewDescriptor> viewDescriptors = new ArrayList<CreateViewRequest.ViewDescriptor>(childDescriptors.size());
- for(UMLNodeDescriptor next : childDescriptors) {
- String hint = UMLVisualIDRegistry.getType(next.getVisualID());
- IAdaptable elementAdapter = new CanonicalElementAdapter(next.getModelElement(), hint);
- CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(elementAdapter, Node.class, hint, ViewUtil.APPEND, false, host().getDiagramPreferencesHint());
- viewDescriptors.add(descriptor);
-
- LinkedList<View> possibleMatches = potentialViews.get(next);
- if(possibleMatches != null) {
- // from potential matches, leave those that were not eventually used for some other NodeDescriptor (i.e. those left as orphaned)
- possibleMatches.retainAll(knownViewChildren);
- }
- if(possibleMatches != null && !possibleMatches.isEmpty()) {
- View originalView = possibleMatches.getFirst();
- knownViewChildren.remove(originalView); // remove not to copy properties of the same view again and again
- // add command to copy properties
- if(originalView instanceof Node) {
- if(((Node)originalView).getLayoutConstraint() instanceof Bounds) {
- Bounds b = (Bounds)((Node)originalView).getLayoutConstraint();
- boundsCommand.add(new SetBoundsCommand(boundsCommand.getEditingDomain(), boundsCommand.getLabel(), descriptor, new Rectangle(b.getX(), b.getY(), b.getWidth(), b.getHeight())));
- } else if(((Node)originalView).getLayoutConstraint() instanceof Location) {
- Location l = (Location)((Node)originalView).getLayoutConstraint();
- boundsCommand.add(new SetBoundsCommand(boundsCommand.getEditingDomain(), boundsCommand.getLabel(), descriptor, new Point(l.getX(), l.getY())));
- } else if(((Node)originalView).getLayoutConstraint() instanceof Size) {
- Size s = (Size)((Node)originalView).getLayoutConstraint();
- boundsCommand.add(new SetBoundsCommand(boundsCommand.getEditingDomain(), boundsCommand.getLabel(), descriptor, new Dimension(s.getWidth(), s.getHeight())));
- }
- }
- }
- }
-
- boolean changed = deleteViews(orphaned.iterator());
- //
- CreateViewRequest request = getCreateViewRequest(viewDescriptors);
- Command cmd = getCreateViewCommand(request);
- if(cmd != null && cmd.canExecute()) {
- SetViewMutabilityCommand.makeMutable(new EObjectAdapter(host().getNotationView())).execute();
- executeCommand(cmd);
- if(boundsCommand.canExecute()) {
- executeCommand(new ICommandProxy(boundsCommand.reduce()));
- }
- @SuppressWarnings("unchecked")
- List<IAdaptable> nl = (List<IAdaptable>)request.getNewObject();
- createdViews.addAll(nl);
- }
- if(changed || createdViews.size() > 0) {
- postProcessRefreshSemantic(createdViews);
- }
- if(createdViews.size() > 1) {
- // perform a layout of the container
- DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
- executeCommand(new ICommandProxy(layoutCmd));
- }
-
- makeViewsImmutable(createdViews);
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/RegionCompartmentItemSemanticEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/RegionCompartmentItemSemanticEditPolicy.java
deleted file mode 100644
index 9400b52e500..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/RegionCompartmentItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.FinalStateCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.PseudostateChoiceCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.PseudostateDeepHistoryCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.PseudostateEntryPointCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.PseudostateExitPointCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.PseudostateForkCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.PseudostateInitialCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.PseudostateJoinCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.PseudostateJunctionCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.PseudostateShallowHistoryCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.PseudostateTerminateCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.StateCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class RegionCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public RegionCompartmentItemSemanticEditPolicy() {
- super(UMLElementTypes.Region_3000);
- }
-
- /**
- * @generated
- */
- protected Command getCreateCommand(CreateElementRequest req) {
- if(UMLElementTypes.Pseudostate_8000 == req.getElementType()) {
- return getGEFWrapper(new PseudostateInitialCreateCommand(req));
- }
- if(UMLElementTypes.Pseudostate_9000 == req.getElementType()) {
- return getGEFWrapper(new PseudostateJoinCreateCommand(req));
- }
- if(UMLElementTypes.Pseudostate_10000 == req.getElementType()) {
- return getGEFWrapper(new PseudostateForkCreateCommand(req));
- }
- if(UMLElementTypes.Pseudostate_11000 == req.getElementType()) {
- return getGEFWrapper(new PseudostateChoiceCreateCommand(req));
- }
- if(UMLElementTypes.Pseudostate_12000 == req.getElementType()) {
- return getGEFWrapper(new PseudostateJunctionCreateCommand(req));
- }
- if(UMLElementTypes.Pseudostate_13000 == req.getElementType()) {
- return getGEFWrapper(new PseudostateShallowHistoryCreateCommand(req));
- }
- if(UMLElementTypes.Pseudostate_14000 == req.getElementType()) {
- return getGEFWrapper(new PseudostateDeepHistoryCreateCommand(req));
- }
- if(UMLElementTypes.Pseudostate_15000 == req.getElementType()) {
- return getGEFWrapper(new PseudostateTerminateCreateCommand(req));
- }
- if(UMLElementTypes.FinalState_5000 == req.getElementType()) {
- return getGEFWrapper(new FinalStateCreateCommand(req));
- }
- if(UMLElementTypes.State_6000 == req.getElementType()) {
- return getGEFWrapper(new StateCreateCommand(req));
- }
- if(UMLElementTypes.Pseudostate_16000 == req.getElementType()) {
- return getGEFWrapper(new PseudostateEntryPointCreateCommand(req));
- }
- if(UMLElementTypes.Pseudostate_17000 == req.getElementType()) {
- return getGEFWrapper(new PseudostateExitPointCreateCommand(req));
- }
- return super.getCreateCommand(req);
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/RegionItemSemanticEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/RegionItemSemanticEditPolicy.java
deleted file mode 100644
index b454c077da5..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/RegionItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,415 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
-import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.FinalStateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateChoiceEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateDeepHistoryEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateForkEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateInitialEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJoinEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJunctionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateShallowHistoryEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateTerminateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class RegionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public RegionItemSemanticEditPolicy() {
- super(UMLElementTypes.Region_3000);
- }
-
- /**
- * @generated
- */
- protected void addDestroyChildNodesCommand(ICompositeCommand cmd) {
- View view = (View)getHost().getModel();
- for(Iterator<?> nit = view.getChildren().iterator(); nit.hasNext();) {
- Node node = (Node)nit.next();
- switch(UMLVisualIDRegistry.getVisualID(node)) {
- case RegionCompartmentEditPart.VISUAL_ID:
- for(Iterator<?> cit = node.getChildren().iterator(); cit.hasNext();) {
- Node cnode = (Node)cit.next();
- switch(UMLVisualIDRegistry.getVisualID(cnode)) {
- case PseudostateInitialEditPart.VISUAL_ID:
-
- for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
- break;
- }
- }
-
- for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
- Edge outgoingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(outgoingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
- break;
- }
- }
- cmd.add(new DestroyElementCommand(new DestroyElementRequest(getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
- // don't need explicit deletion of cnode as parent's view deletion would clean child views as well
- // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
- break;
- case PseudostateJoinEditPart.VISUAL_ID:
-
- for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
- break;
- }
- }
-
- for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
- Edge outgoingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(outgoingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
- break;
- }
- }
- cmd.add(new DestroyElementCommand(new DestroyElementRequest(getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
- // don't need explicit deletion of cnode as parent's view deletion would clean child views as well
- // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
- break;
- case PseudostateForkEditPart.VISUAL_ID:
-
- for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
- break;
- }
- }
-
- for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
- Edge outgoingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(outgoingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
- break;
- }
- }
- cmd.add(new DestroyElementCommand(new DestroyElementRequest(getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
- // don't need explicit deletion of cnode as parent's view deletion would clean child views as well
- // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
- break;
- case PseudostateChoiceEditPart.VISUAL_ID:
-
- for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
- break;
- }
- }
-
- for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
- Edge outgoingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(outgoingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
- break;
- }
- }
- cmd.add(new DestroyElementCommand(new DestroyElementRequest(getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
- // don't need explicit deletion of cnode as parent's view deletion would clean child views as well
- // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
- break;
- case PseudostateJunctionEditPart.VISUAL_ID:
-
- for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
- break;
- }
- }
-
- for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
- Edge outgoingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(outgoingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
- break;
- }
- }
- cmd.add(new DestroyElementCommand(new DestroyElementRequest(getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
- // don't need explicit deletion of cnode as parent's view deletion would clean child views as well
- // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
- break;
- case PseudostateShallowHistoryEditPart.VISUAL_ID:
-
- for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
- break;
- }
- }
-
- for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
- Edge outgoingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(outgoingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
- break;
- }
- }
- cmd.add(new DestroyElementCommand(new DestroyElementRequest(getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
- // don't need explicit deletion of cnode as parent's view deletion would clean child views as well
- // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
- break;
- case PseudostateDeepHistoryEditPart.VISUAL_ID:
-
- for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
- break;
- }
- }
-
- for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
- Edge outgoingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(outgoingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
- break;
- }
- }
- cmd.add(new DestroyElementCommand(new DestroyElementRequest(getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
- // don't need explicit deletion of cnode as parent's view deletion would clean child views as well
- // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
- break;
- case PseudostateTerminateEditPart.VISUAL_ID:
-
- for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
- break;
- }
- }
-
- for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
- Edge outgoingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(outgoingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
- break;
- }
- }
- cmd.add(new DestroyElementCommand(new DestroyElementRequest(getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
- // don't need explicit deletion of cnode as parent's view deletion would clean child views as well
- // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
- break;
- case FinalStateEditPart.VISUAL_ID:
-
- for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
- break;
- }
- }
-
- for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
- Edge outgoingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(outgoingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
- break;
- }
- }
- cmd.add(new DestroyElementCommand(new DestroyElementRequest(getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
- // don't need explicit deletion of cnode as parent's view deletion would clean child views as well
- // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
- break;
- case StateEditPart.VISUAL_ID:
-
- for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
- break;
- }
- }
-
- for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
- Edge outgoingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(outgoingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
- break;
- }
- }
- cmd.add(new DestroyElementCommand(new DestroyElementRequest(getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
- // don't need explicit deletion of cnode as parent's view deletion would clean child views as well
- // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
- break;
- case PseudostateEntryPointEditPart.VISUAL_ID:
-
- for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
- break;
- }
- }
-
- for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
- Edge outgoingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(outgoingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
- break;
- }
- }
- cmd.add(new DestroyElementCommand(new DestroyElementRequest(getEditingDomain(), cnode.getElement(), false))); // directlyOwned: false
- // don't need explicit deletion of cnode as parent's view deletion would clean child views as well
- // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
- break;
- case PseudostateExitPointEditPart.VISUAL_ID:
-
- for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
- break;
- }
- }
-
- for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
- Edge outgoingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(outgoingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
- break;
- }
- }
- cmd.add(new DestroyElementCommand(new DestroyElementRequest(getEditingDomain(), cnode.getElement(), false))); // directlyOwned: false
- // don't need explicit deletion of cnode as parent's view deletion would clean child views as well
- // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
- break;
- }
- }
- break;
- }
- }
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- View view = (View)getHost().getModel();
- CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(true);
-
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if(annotation == null) {
- // there are indirectly referenced children, need extra commands: true
- addDestroyChildNodesCommand(cmd);
- addDestroyShortcutsCommand(cmd, view);
- // delete host element
- List<EObject> todestroy = new ArrayList<EObject>();
- todestroy.add(req.getElementToDestroy());
- //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- cmd.add(new EMFtoGMFCommandWrapper(new org.eclipse.emf.edit.command.DeleteCommand(getEditingDomain(), todestroy)));
- } else {
- cmd.add(new DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateCanonicalEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateCanonicalEditPolicy.java
deleted file mode 100644
index 52930ce3ab1..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateCanonicalEditPolicy.java
+++ /dev/null
@@ -1,225 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SetViewMutabilityCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.notation.Bounds;
-import org.eclipse.gmf.runtime.notation.Location;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.Size;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.ConnectionPointReferenceEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramUpdater;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLNodeDescriptor;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class StateCanonicalEditPolicy extends CanonicalEditPolicy {
-
- /**
- * @generated
- */
- private Set<EStructuralFeature> myFeaturesToSynchronize;
-
- /**
- * @generated
- */
- protected void refreshOnActivate() {
- // Need to activate editpart children before invoking the canonical refresh for EditParts to add event listeners
- List<?> c = getHost().getChildren();
- for(int i = 0; i < c.size(); i++) {
- ((EditPart)c.get(i)).activate();
- }
- super.refreshOnActivate();
- }
-
- /**
- * @generated
- */
- protected Set getFeaturesToSynchronize() {
- if(myFeaturesToSynchronize == null) {
- myFeaturesToSynchronize = new HashSet<EStructuralFeature>();
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getStateMachine_Region());
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getStateMachine_ConnectionPoint());
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getState_Connection());
- }
- return myFeaturesToSynchronize;
- }
-
- /**
- * @generated
- */
- @SuppressWarnings("rawtypes")
- protected List getSemanticChildrenList() {
- View viewObject = (View)getHost().getModel();
- LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.getState_6000SemanticChildren(viewObject);
- for(UMLNodeDescriptor d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- }
-
- /**
- * @generated
- */
- private boolean isMyDiagramElement(View view) {
- int visualID = UMLVisualIDRegistry.getVisualID(view);
- switch(visualID) {
- case RegionEditPart.VISUAL_ID:
- case PseudostateEntryPointEditPart.VISUAL_ID:
- case PseudostateExitPointEditPart.VISUAL_ID:
- case ConnectionPointReferenceEditPart.VISUAL_ID:
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) {
- return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement());
- }
-
- /**
- * @generated
- */
- protected void refreshSemantic() {
- if(resolveSemanticElement() == null) {
- return;
- }
- LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.getState_6000SemanticChildren((View)getHost().getModel());
- LinkedList<View> orphaned = new LinkedList<View>();
- // we care to check only views we recognize as ours
- LinkedList<View> knownViewChildren = new LinkedList<View>();
- for(View v : getViewChildren()) {
- if(isMyDiagramElement(v)) {
- knownViewChildren.add(v);
- }
- }
- // alternative to #cleanCanonicalSemanticChildren(getViewChildren(), semanticChildren)
- HashMap<UMLNodeDescriptor, LinkedList<View>> potentialViews = new HashMap<UMLNodeDescriptor, LinkedList<View>>();
- //
- // iteration happens over list of desired semantic elements, trying to find best matching View, while original CEP
- // iterates views, potentially losing view (size/bounds) information - i.e. if there are few views to reference same EObject, only last one
- // to answer isOrphaned == true will be used for the domain element representation, see #cleanCanonicalSemanticChildren()
- for(Iterator<UMLNodeDescriptor> descriptorsIterator = childDescriptors.iterator(); descriptorsIterator.hasNext();) {
- UMLNodeDescriptor next = descriptorsIterator.next();
- String hint = UMLVisualIDRegistry.getType(next.getVisualID());
- LinkedList<View> perfectMatch = new LinkedList<View>(); // both semanticElement and hint match that of NodeDescriptor
- LinkedList<View> potentialMatch = new LinkedList<View>(); // semanticElement matches, hint does not
- for(View childView : getViewChildren()) {
- EObject semanticElement = childView.getElement();
- if(next.getModelElement().equals(semanticElement)) {
- if(hint.equals(childView.getType())) {
- perfectMatch.add(childView);
- // actually, can stop iteration over view children here, but
- // may want to use not the first view but last one as a 'real' match (the way original CEP does
- // with its trick with viewToSemanticMap inside #cleanCanonicalSemanticChildren
- } else {
- potentialMatch.add(childView);
- }
- }
- }
- if(perfectMatch.size() > 0) {
- descriptorsIterator.remove(); // precise match found no need to create anything for the NodeDescriptor
- // use only one view (first or last?), keep rest as orphaned for further consideration
- knownViewChildren.remove(perfectMatch.getFirst());
- } else if(potentialMatch.size() > 0) {
- potentialViews.put(next, potentialMatch);
- }
- }
- // those left in knownViewChildren are subject to removal - they are our diagram elements we didn't find match to,
- // or those we have potential matches to, and thus need to be recreated, preserving size/location information.
- orphaned.addAll(knownViewChildren);
- //
- CompositeTransactionalCommand boundsCommand = new CompositeTransactionalCommand(host().getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize);
- ArrayList<CreateViewRequest.ViewDescriptor> viewDescriptors = new ArrayList<CreateViewRequest.ViewDescriptor>(childDescriptors.size());
- for(UMLNodeDescriptor next : childDescriptors) {
- String hint = UMLVisualIDRegistry.getType(next.getVisualID());
- IAdaptable elementAdapter = new CanonicalElementAdapter(next.getModelElement(), hint);
- CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(elementAdapter, Node.class, hint, ViewUtil.APPEND, false, host().getDiagramPreferencesHint());
- viewDescriptors.add(descriptor);
-
- LinkedList<View> possibleMatches = potentialViews.get(next);
- if(possibleMatches != null) {
- // from potential matches, leave those that were not eventually used for some other NodeDescriptor (i.e. those left as orphaned)
- possibleMatches.retainAll(knownViewChildren);
- }
- if(possibleMatches != null && !possibleMatches.isEmpty()) {
- View originalView = possibleMatches.getFirst();
- knownViewChildren.remove(originalView); // remove not to copy properties of the same view again and again
- // add command to copy properties
- if(originalView instanceof Node) {
- if(((Node)originalView).getLayoutConstraint() instanceof Bounds) {
- Bounds b = (Bounds)((Node)originalView).getLayoutConstraint();
- boundsCommand.add(new SetBoundsCommand(boundsCommand.getEditingDomain(), boundsCommand.getLabel(), descriptor, new Rectangle(b.getX(), b.getY(), b.getWidth(), b.getHeight())));
- } else if(((Node)originalView).getLayoutConstraint() instanceof Location) {
- Location l = (Location)((Node)originalView).getLayoutConstraint();
- boundsCommand.add(new SetBoundsCommand(boundsCommand.getEditingDomain(), boundsCommand.getLabel(), descriptor, new Point(l.getX(), l.getY())));
- } else if(((Node)originalView).getLayoutConstraint() instanceof Size) {
- Size s = (Size)((Node)originalView).getLayoutConstraint();
- boundsCommand.add(new SetBoundsCommand(boundsCommand.getEditingDomain(), boundsCommand.getLabel(), descriptor, new Dimension(s.getWidth(), s.getHeight())));
- }
- }
- }
- }
-
- boolean changed = deleteViews(orphaned.iterator());
- //
- CreateViewRequest request = getCreateViewRequest(viewDescriptors);
- Command cmd = getCreateViewCommand(request);
- if(cmd != null && cmd.canExecute()) {
- SetViewMutabilityCommand.makeMutable(new EObjectAdapter(host().getNotationView())).execute();
- executeCommand(cmd);
- if(boundsCommand.canExecute()) {
- executeCommand(new ICommandProxy(boundsCommand.reduce()));
- }
- @SuppressWarnings("unchecked")
- List<IAdaptable> nl = (List<IAdaptable>)request.getNewObject();
- createdViews.addAll(nl);
- }
- if(changed || createdViews.size() > 0) {
- postProcessRefreshSemantic(createdViews);
- }
- if(createdViews.size() > 1) {
- // perform a layout of the container
- DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
- executeCommand(new ICommandProxy(layoutCmd));
- }
-
- makeViewsImmutable(createdViews);
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateCompartmentCanonicalEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateCompartmentCanonicalEditPolicy.java
deleted file mode 100644
index 625757e3492..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateCompartmentCanonicalEditPolicy.java
+++ /dev/null
@@ -1,172 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SetViewMutabilityCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.ConnectionPointReferenceEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramUpdater;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLNodeDescriptor;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class StateCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
-
- /**
- * @generated
- */
- private Set<EStructuralFeature> myFeaturesToSynchronize;
-
- /**
- * @generated
- */
- protected void refreshOnActivate() {
- // Need to activate editpart children before invoking the canonical refresh for EditParts to add event listeners
- List<?> c = getHost().getChildren();
- for(int i = 0; i < c.size(); i++) {
- ((EditPart)c.get(i)).activate();
- }
- super.refreshOnActivate();
- }
-
- /**
- * @generated
- */
- protected Set getFeaturesToSynchronize() {
- if(myFeaturesToSynchronize == null) {
- myFeaturesToSynchronize = new HashSet<EStructuralFeature>();
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getStateMachine_Region());
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getState_Connection());
- }
- return myFeaturesToSynchronize;
- }
-
- /**
- * @generated
- */
- @SuppressWarnings("rawtypes")
- protected List getSemanticChildrenList() {
- View viewObject = (View)getHost().getModel();
- LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.getStateStateCompartment_6002SemanticChildren(viewObject);
- for(UMLNodeDescriptor d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- }
-
- /**
- * @generated
- */
- private boolean isMyDiagramElement(View view) {
- int visualID = UMLVisualIDRegistry.getVisualID(view);
- return visualID == RegionEditPart.VISUAL_ID || visualID == ConnectionPointReferenceEditPart.VISUAL_ID;
- }
-
- /**
- * @generated
- */
- protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) {
- return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement());
- }
-
- /**
- * @generated
- */
- protected void refreshSemantic() {
- if(resolveSemanticElement() == null) {
- return;
- }
- LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.getStateStateCompartment_6002SemanticChildren((View)getHost().getModel());
- LinkedList<View> orphaned = new LinkedList<View>();
- // we care to check only views we recognize as ours
- LinkedList<View> knownViewChildren = new LinkedList<View>();
- for(View v : getViewChildren()) {
- if(isMyDiagramElement(v)) {
- knownViewChildren.add(v);
- }
- }
- // alternative to #cleanCanonicalSemanticChildren(getViewChildren(), semanticChildren)
- //
- // iteration happens over list of desired semantic elements, trying to find best matching View, while original CEP
- // iterates views, potentially losing view (size/bounds) information - i.e. if there are few views to reference same EObject, only last one
- // to answer isOrphaned == true will be used for the domain element representation, see #cleanCanonicalSemanticChildren()
- for(Iterator<UMLNodeDescriptor> descriptorsIterator = childDescriptors.iterator(); descriptorsIterator.hasNext();) {
- UMLNodeDescriptor next = descriptorsIterator.next();
- String hint = UMLVisualIDRegistry.getType(next.getVisualID());
- LinkedList<View> perfectMatch = new LinkedList<View>(); // both semanticElement and hint match that of NodeDescriptor
- for(View childView : getViewChildren()) {
- EObject semanticElement = childView.getElement();
- if(next.getModelElement().equals(semanticElement)) {
- if(hint.equals(childView.getType())) {
- perfectMatch.add(childView);
- // actually, can stop iteration over view children here, but
- // may want to use not the first view but last one as a 'real' match (the way original CEP does
- // with its trick with viewToSemanticMap inside #cleanCanonicalSemanticChildren
- }
- }
- }
- if(perfectMatch.size() > 0) {
- descriptorsIterator.remove(); // precise match found no need to create anything for the NodeDescriptor
- // use only one view (first or last?), keep rest as orphaned for further consideration
- knownViewChildren.remove(perfectMatch.getFirst());
- }
- }
- // those left in knownViewChildren are subject to removal - they are our diagram elements we didn't find match to,
- // or those we have potential matches to, and thus need to be recreated, preserving size/location information.
- orphaned.addAll(knownViewChildren);
- //
- ArrayList<CreateViewRequest.ViewDescriptor> viewDescriptors = new ArrayList<CreateViewRequest.ViewDescriptor>(childDescriptors.size());
- for(UMLNodeDescriptor next : childDescriptors) {
- String hint = UMLVisualIDRegistry.getType(next.getVisualID());
- IAdaptable elementAdapter = new CanonicalElementAdapter(next.getModelElement(), hint);
- CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(elementAdapter, Node.class, hint, ViewUtil.APPEND, false, host().getDiagramPreferencesHint());
- viewDescriptors.add(descriptor);
- }
-
- boolean changed = deleteViews(orphaned.iterator());
- //
- CreateViewRequest request = getCreateViewRequest(viewDescriptors);
- Command cmd = getCreateViewCommand(request);
- if(cmd != null && cmd.canExecute()) {
- SetViewMutabilityCommand.makeMutable(new EObjectAdapter(host().getNotationView())).execute();
- executeCommand(cmd);
- @SuppressWarnings("unchecked")
- List<IAdaptable> nl = (List<IAdaptable>)request.getNewObject();
- createdViews.addAll(nl);
- }
- if(changed || createdViews.size() > 0) {
- postProcessRefreshSemantic(createdViews);
- }
- if(createdViews.size() > 1) {
- // perform a layout of the container
- DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
- executeCommand(new ICommandProxy(layoutCmd));
- }
-
- makeViewsImmutable(createdViews);
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateCompartmentItemSemanticEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateCompartmentItemSemanticEditPolicy.java
deleted file mode 100644
index f1866b1c774..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateCompartmentItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.ConnectionPointReferenceCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.RegionCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class StateCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public StateCompartmentItemSemanticEditPolicy() {
- super(UMLElementTypes.State_6000);
- }
-
- /**
- * @generated
- */
- protected Command getCreateCommand(CreateElementRequest req) {
- if(UMLElementTypes.Region_3000 == req.getElementType()) {
- return getGEFWrapper(new RegionCreateCommand(req));
- }
- if(UMLElementTypes.ConnectionPointReference_18000 == req.getElementType()) {
- return getGEFWrapper(new ConnectionPointReferenceCreateCommand(req));
- }
- return super.getCreateCommand(req);
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateItemSemanticEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateItemSemanticEditPolicy.java
deleted file mode 100644
index 414b1f11aa1..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,273 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
-import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
-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.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.ConnectionPointReferenceCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.PseudostateEntryPointCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.PseudostateExitPointCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.RegionCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.TransitionReorientCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.ConnectionPointReferenceEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class StateItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public StateItemSemanticEditPolicy() {
- super(UMLElementTypes.State_6000);
- }
-
- /**
- * @generated
- */
- protected void addDestroyChildNodesCommand(ICompositeCommand cmd) {
- View view = (View)getHost().getModel();
- for(Iterator<?> nit = view.getChildren().iterator(); nit.hasNext();) {
- Node node = (Node)nit.next();
- switch(UMLVisualIDRegistry.getVisualID(node)) {
- case RegionEditPart.VISUAL_ID:
-
- cmd.add(new DestroyElementCommand(new DestroyElementRequest(getEditingDomain(), node.getElement(), false))); // directlyOwned: false
- // don't need explicit deletion of node as parent's view deletion would clean child views as well
- // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), node));
- break;
- case PseudostateEntryPointEditPart.VISUAL_ID:
-
- for(Iterator<?> it = node.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
- break;
- }
- }
-
- for(Iterator<?> it = node.getSourceEdges().iterator(); it.hasNext();) {
- Edge outgoingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(outgoingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
- break;
- }
- }
- cmd.add(new DestroyElementCommand(new DestroyElementRequest(getEditingDomain(), node.getElement(), false))); // directlyOwned: false
- // don't need explicit deletion of node as parent's view deletion would clean child views as well
- // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), node));
- break;
- case PseudostateExitPointEditPart.VISUAL_ID:
-
- for(Iterator<?> it = node.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
- break;
- }
- }
-
- for(Iterator<?> it = node.getSourceEdges().iterator(); it.hasNext();) {
- Edge outgoingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(outgoingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
- break;
- }
- }
- cmd.add(new DestroyElementCommand(new DestroyElementRequest(getEditingDomain(), node.getElement(), false))); // directlyOwned: false
- // don't need explicit deletion of node as parent's view deletion would clean child views as well
- // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), node));
- break;
- case ConnectionPointReferenceEditPart.VISUAL_ID:
-
- for(Iterator<?> it = node.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
- break;
- }
- }
-
- for(Iterator<?> it = node.getSourceEdges().iterator(); it.hasNext();) {
- Edge outgoingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(outgoingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
- break;
- }
- }
- cmd.add(new DestroyElementCommand(new DestroyElementRequest(getEditingDomain(), node.getElement(), false))); // directlyOwned: true
- // don't need explicit deletion of node as parent's view deletion would clean child views as well
- // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), node));
- break;
- case StateCompartmentEditPart.VISUAL_ID:
- for(Iterator<?> cit = node.getChildren().iterator(); cit.hasNext();) {
- Node cnode = (Node)cit.next();
- switch(UMLVisualIDRegistry.getVisualID(cnode)) {
- case RegionEditPart.VISUAL_ID:
-
- cmd.add(new DestroyElementCommand(new DestroyElementRequest(getEditingDomain(), cnode.getElement(), false))); // directlyOwned: false
- // don't need explicit deletion of cnode as parent's view deletion would clean child views as well
- // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
- break;
- case ConnectionPointReferenceEditPart.VISUAL_ID:
-
- for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
- break;
- }
- }
-
- for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
- Edge outgoingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(outgoingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
- break;
- }
- }
- cmd.add(new DestroyElementCommand(new DestroyElementRequest(getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
- // don't need explicit deletion of cnode as parent's view deletion would clean child views as well
- // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
- break;
- }
- }
- break;
- }
- }
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateCommand(CreateElementRequest req) {
- if(UMLElementTypes.Region_3000 == req.getElementType()) {
- return getGEFWrapper(new RegionCreateCommand(req));
- }
- if(UMLElementTypes.Pseudostate_16000 == req.getElementType()) {
- return getGEFWrapper(new PseudostateEntryPointCreateCommand(req));
- }
- if(UMLElementTypes.Pseudostate_17000 == req.getElementType()) {
- return getGEFWrapper(new PseudostateExitPointCreateCommand(req));
- }
- if(UMLElementTypes.ConnectionPointReference_18000 == req.getElementType()) {
- return getGEFWrapper(new ConnectionPointReferenceCreateCommand(req));
- }
- return super.getCreateCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- View view = (View)getHost().getModel();
- CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(true);
-
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if(annotation == null) {
- // there are indirectly referenced children, need extra commands: true
- addDestroyChildNodesCommand(cmd);
- addDestroyShortcutsCommand(cmd, view);
- // delete host element
- List<EObject> todestroy = new ArrayList<EObject>();
- todestroy.add(req.getElementToDestroy());
- //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- cmd.add(new EMFtoGMFCommandWrapper(new org.eclipse.emf.edit.command.DeleteCommand(getEditingDomain(), todestroy)));
- } else {
- cmd.add(new DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch(getVisualID(req)) {
- case TransitionEditPart.VISUAL_ID:
- return getGEFWrapper(new TransitionReorientCommand(req));
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Transition_7000 == req.getElementType()) {
- return getGEFWrapper(new TransitionCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateMachineCanonicalEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateMachineCanonicalEditPolicy.java
deleted file mode 100644
index f783b4ad589..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateMachineCanonicalEditPolicy.java
+++ /dev/null
@@ -1,203 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SetViewMutabilityCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.notation.Bounds;
-import org.eclipse.gmf.runtime.notation.Location;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.Size;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramUpdater;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLNodeDescriptor;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class StateMachineCanonicalEditPolicy extends CanonicalEditPolicy {
-
- /**
- * @generated
- */
- protected void refreshOnActivate() {
- // Need to activate editpart children before invoking the canonical refresh for EditParts to add event listeners
- List<?> c = getHost().getChildren();
- for(int i = 0; i < c.size(); i++) {
- ((EditPart)c.get(i)).activate();
- }
- super.refreshOnActivate();
- }
-
- /**
- * @generated
- */
- protected EStructuralFeature getFeatureToSynchronize() {
- return UMLPackage.eINSTANCE.getStateMachine_ConnectionPoint();
- }
-
- /**
- * @generated
- */
- @SuppressWarnings("rawtypes")
- protected List getSemanticChildrenList() {
- View viewObject = (View)getHost().getModel();
- LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.getStateMachine_2000SemanticChildren(viewObject);
- for(UMLNodeDescriptor d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- }
-
- /**
- * @generated
- */
- private boolean isMyDiagramElement(View view) {
- int visualID = UMLVisualIDRegistry.getVisualID(view);
- return visualID == PseudostateEntryPointEditPart.VISUAL_ID || visualID == PseudostateExitPointEditPart.VISUAL_ID;
- }
-
- /**
- * @generated
- */
- protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) {
- return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement());
- }
-
- /**
- * @generated
- */
- protected void refreshSemantic() {
- if(resolveSemanticElement() == null) {
- return;
- }
- LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.getStateMachine_2000SemanticChildren((View)getHost().getModel());
- LinkedList<View> orphaned = new LinkedList<View>();
- // we care to check only views we recognize as ours
- LinkedList<View> knownViewChildren = new LinkedList<View>();
- for(View v : getViewChildren()) {
- if(isMyDiagramElement(v)) {
- knownViewChildren.add(v);
- }
- }
- // alternative to #cleanCanonicalSemanticChildren(getViewChildren(), semanticChildren)
- HashMap<UMLNodeDescriptor, LinkedList<View>> potentialViews = new HashMap<UMLNodeDescriptor, LinkedList<View>>();
- //
- // iteration happens over list of desired semantic elements, trying to find best matching View, while original CEP
- // iterates views, potentially losing view (size/bounds) information - i.e. if there are few views to reference same EObject, only last one
- // to answer isOrphaned == true will be used for the domain element representation, see #cleanCanonicalSemanticChildren()
- for(Iterator<UMLNodeDescriptor> descriptorsIterator = childDescriptors.iterator(); descriptorsIterator.hasNext();) {
- UMLNodeDescriptor next = descriptorsIterator.next();
- String hint = UMLVisualIDRegistry.getType(next.getVisualID());
- LinkedList<View> perfectMatch = new LinkedList<View>(); // both semanticElement and hint match that of NodeDescriptor
- LinkedList<View> potentialMatch = new LinkedList<View>(); // semanticElement matches, hint does not
- for(View childView : getViewChildren()) {
- EObject semanticElement = childView.getElement();
- if(next.getModelElement().equals(semanticElement)) {
- if(hint.equals(childView.getType())) {
- perfectMatch.add(childView);
- // actually, can stop iteration over view children here, but
- // may want to use not the first view but last one as a 'real' match (the way original CEP does
- // with its trick with viewToSemanticMap inside #cleanCanonicalSemanticChildren
- } else {
- potentialMatch.add(childView);
- }
- }
- }
- if(perfectMatch.size() > 0) {
- descriptorsIterator.remove(); // precise match found no need to create anything for the NodeDescriptor
- // use only one view (first or last?), keep rest as orphaned for further consideration
- knownViewChildren.remove(perfectMatch.getFirst());
- } else if(potentialMatch.size() > 0) {
- potentialViews.put(next, potentialMatch);
- }
- }
- // those left in knownViewChildren are subject to removal - they are our diagram elements we didn't find match to,
- // or those we have potential matches to, and thus need to be recreated, preserving size/location information.
- orphaned.addAll(knownViewChildren);
- //
- CompositeTransactionalCommand boundsCommand = new CompositeTransactionalCommand(host().getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize);
- ArrayList<CreateViewRequest.ViewDescriptor> viewDescriptors = new ArrayList<CreateViewRequest.ViewDescriptor>(childDescriptors.size());
- for(UMLNodeDescriptor next : childDescriptors) {
- String hint = UMLVisualIDRegistry.getType(next.getVisualID());
- IAdaptable elementAdapter = new CanonicalElementAdapter(next.getModelElement(), hint);
- CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(elementAdapter, Node.class, hint, ViewUtil.APPEND, false, host().getDiagramPreferencesHint());
- viewDescriptors.add(descriptor);
-
- LinkedList<View> possibleMatches = potentialViews.get(next);
- if(possibleMatches != null) {
- // from potential matches, leave those that were not eventually used for some other NodeDescriptor (i.e. those left as orphaned)
- possibleMatches.retainAll(knownViewChildren);
- }
- if(possibleMatches != null && !possibleMatches.isEmpty()) {
- View originalView = possibleMatches.getFirst();
- knownViewChildren.remove(originalView); // remove not to copy properties of the same view again and again
- // add command to copy properties
- if(originalView instanceof Node) {
- if(((Node)originalView).getLayoutConstraint() instanceof Bounds) {
- Bounds b = (Bounds)((Node)originalView).getLayoutConstraint();
- boundsCommand.add(new SetBoundsCommand(boundsCommand.getEditingDomain(), boundsCommand.getLabel(), descriptor, new Rectangle(b.getX(), b.getY(), b.getWidth(), b.getHeight())));
- } else if(((Node)originalView).getLayoutConstraint() instanceof Location) {
- Location l = (Location)((Node)originalView).getLayoutConstraint();
- boundsCommand.add(new SetBoundsCommand(boundsCommand.getEditingDomain(), boundsCommand.getLabel(), descriptor, new Point(l.getX(), l.getY())));
- } else if(((Node)originalView).getLayoutConstraint() instanceof Size) {
- Size s = (Size)((Node)originalView).getLayoutConstraint();
- boundsCommand.add(new SetBoundsCommand(boundsCommand.getEditingDomain(), boundsCommand.getLabel(), descriptor, new Dimension(s.getWidth(), s.getHeight())));
- }
- }
- }
- }
-
- boolean changed = deleteViews(orphaned.iterator());
- //
- CreateViewRequest request = getCreateViewRequest(viewDescriptors);
- Command cmd = getCreateViewCommand(request);
- if(cmd != null && cmd.canExecute()) {
- SetViewMutabilityCommand.makeMutable(new EObjectAdapter(host().getNotationView())).execute();
- executeCommand(cmd);
- if(boundsCommand.canExecute()) {
- executeCommand(new ICommandProxy(boundsCommand.reduce()));
- }
- @SuppressWarnings("unchecked")
- List<IAdaptable> nl = (List<IAdaptable>)request.getNewObject();
- createdViews.addAll(nl);
- }
- if(changed || createdViews.size() > 0) {
- postProcessRefreshSemantic(createdViews);
- }
- if(createdViews.size() > 1) {
- // perform a layout of the container
- DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
- executeCommand(new ICommandProxy(layoutCmd));
- }
-
- makeViewsImmutable(createdViews);
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateMachineCompartmentCanonicalEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateMachineCompartmentCanonicalEditPolicy.java
deleted file mode 100644
index a002314e9e6..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateMachineCompartmentCanonicalEditPolicy.java
+++ /dev/null
@@ -1,217 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SetViewMutabilityCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.notation.Bounds;
-import org.eclipse.gmf.runtime.notation.Location;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.Size;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramUpdater;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLNodeDescriptor;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class StateMachineCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
-
- /**
- * @generated
- */
- private Set<EStructuralFeature> myFeaturesToSynchronize;
-
- /**
- * @generated
- */
- protected void refreshOnActivate() {
- // Need to activate editpart children before invoking the canonical refresh for EditParts to add event listeners
- List<?> c = getHost().getChildren();
- for(int i = 0; i < c.size(); i++) {
- ((EditPart)c.get(i)).activate();
- }
- super.refreshOnActivate();
- }
-
- /**
- * @generated
- */
- protected Set getFeaturesToSynchronize() {
- if(myFeaturesToSynchronize == null) {
- myFeaturesToSynchronize = new HashSet<EStructuralFeature>();
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getStateMachine_Region());
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getStateMachine_ConnectionPoint());
- }
- return myFeaturesToSynchronize;
- }
-
- /**
- * @generated
- */
- @SuppressWarnings("rawtypes")
- protected List getSemanticChildrenList() {
- View viewObject = (View)getHost().getModel();
- LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.getStateMachineStateMachineCompartment_2002SemanticChildren(viewObject);
- for(UMLNodeDescriptor d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- }
-
- /**
- * @generated
- */
- private boolean isMyDiagramElement(View view) {
- int visualID = UMLVisualIDRegistry.getVisualID(view);
- return visualID == RegionEditPart.VISUAL_ID || visualID == PseudostateEntryPointEditPart.VISUAL_ID || visualID == PseudostateExitPointEditPart.VISUAL_ID;
- }
-
- /**
- * @generated
- */
- protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) {
- return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement());
- }
-
- /**
- * @generated
- */
- protected void refreshSemantic() {
- if(resolveSemanticElement() == null) {
- return;
- }
- LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.getStateMachineStateMachineCompartment_2002SemanticChildren((View)getHost().getModel());
- LinkedList<View> orphaned = new LinkedList<View>();
- // we care to check only views we recognize as ours
- LinkedList<View> knownViewChildren = new LinkedList<View>();
- for(View v : getViewChildren()) {
- if(isMyDiagramElement(v)) {
- knownViewChildren.add(v);
- }
- }
- // alternative to #cleanCanonicalSemanticChildren(getViewChildren(), semanticChildren)
- HashMap<UMLNodeDescriptor, LinkedList<View>> potentialViews = new HashMap<UMLNodeDescriptor, LinkedList<View>>();
- //
- // iteration happens over list of desired semantic elements, trying to find best matching View, while original CEP
- // iterates views, potentially losing view (size/bounds) information - i.e. if there are few views to reference same EObject, only last one
- // to answer isOrphaned == true will be used for the domain element representation, see #cleanCanonicalSemanticChildren()
- for(Iterator<UMLNodeDescriptor> descriptorsIterator = childDescriptors.iterator(); descriptorsIterator.hasNext();) {
- UMLNodeDescriptor next = descriptorsIterator.next();
- String hint = UMLVisualIDRegistry.getType(next.getVisualID());
- LinkedList<View> perfectMatch = new LinkedList<View>(); // both semanticElement and hint match that of NodeDescriptor
- LinkedList<View> potentialMatch = new LinkedList<View>(); // semanticElement matches, hint does not
- for(View childView : getViewChildren()) {
- EObject semanticElement = childView.getElement();
- if(next.getModelElement().equals(semanticElement)) {
- if(hint.equals(childView.getType())) {
- perfectMatch.add(childView);
- // actually, can stop iteration over view children here, but
- // may want to use not the first view but last one as a 'real' match (the way original CEP does
- // with its trick with viewToSemanticMap inside #cleanCanonicalSemanticChildren
- } else {
- potentialMatch.add(childView);
- }
- }
- }
- if(perfectMatch.size() > 0) {
- descriptorsIterator.remove(); // precise match found no need to create anything for the NodeDescriptor
- // use only one view (first or last?), keep rest as orphaned for further consideration
- knownViewChildren.remove(perfectMatch.getFirst());
- } else if(potentialMatch.size() > 0) {
- potentialViews.put(next, potentialMatch);
- }
- }
- // those left in knownViewChildren are subject to removal - they are our diagram elements we didn't find match to,
- // or those we have potential matches to, and thus need to be recreated, preserving size/location information.
- orphaned.addAll(knownViewChildren);
- //
- CompositeTransactionalCommand boundsCommand = new CompositeTransactionalCommand(host().getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize);
- ArrayList<CreateViewRequest.ViewDescriptor> viewDescriptors = new ArrayList<CreateViewRequest.ViewDescriptor>(childDescriptors.size());
- for(UMLNodeDescriptor next : childDescriptors) {
- String hint = UMLVisualIDRegistry.getType(next.getVisualID());
- IAdaptable elementAdapter = new CanonicalElementAdapter(next.getModelElement(), hint);
- CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(elementAdapter, Node.class, hint, ViewUtil.APPEND, false, host().getDiagramPreferencesHint());
- viewDescriptors.add(descriptor);
-
- LinkedList<View> possibleMatches = potentialViews.get(next);
- if(possibleMatches != null) {
- // from potential matches, leave those that were not eventually used for some other NodeDescriptor (i.e. those left as orphaned)
- possibleMatches.retainAll(knownViewChildren);
- }
- if(possibleMatches != null && !possibleMatches.isEmpty()) {
- View originalView = possibleMatches.getFirst();
- knownViewChildren.remove(originalView); // remove not to copy properties of the same view again and again
- // add command to copy properties
- if(originalView instanceof Node) {
- if(((Node)originalView).getLayoutConstraint() instanceof Bounds) {
- Bounds b = (Bounds)((Node)originalView).getLayoutConstraint();
- boundsCommand.add(new SetBoundsCommand(boundsCommand.getEditingDomain(), boundsCommand.getLabel(), descriptor, new Rectangle(b.getX(), b.getY(), b.getWidth(), b.getHeight())));
- } else if(((Node)originalView).getLayoutConstraint() instanceof Location) {
- Location l = (Location)((Node)originalView).getLayoutConstraint();
- boundsCommand.add(new SetBoundsCommand(boundsCommand.getEditingDomain(), boundsCommand.getLabel(), descriptor, new Point(l.getX(), l.getY())));
- } else if(((Node)originalView).getLayoutConstraint() instanceof Size) {
- Size s = (Size)((Node)originalView).getLayoutConstraint();
- boundsCommand.add(new SetBoundsCommand(boundsCommand.getEditingDomain(), boundsCommand.getLabel(), descriptor, new Dimension(s.getWidth(), s.getHeight())));
- }
- }
- }
- }
-
- boolean changed = deleteViews(orphaned.iterator());
- //
- CreateViewRequest request = getCreateViewRequest(viewDescriptors);
- Command cmd = getCreateViewCommand(request);
- if(cmd != null && cmd.canExecute()) {
- SetViewMutabilityCommand.makeMutable(new EObjectAdapter(host().getNotationView())).execute();
- executeCommand(cmd);
- if(boundsCommand.canExecute()) {
- executeCommand(new ICommandProxy(boundsCommand.reduce()));
- }
- @SuppressWarnings("unchecked")
- List<IAdaptable> nl = (List<IAdaptable>)request.getNewObject();
- createdViews.addAll(nl);
- }
- if(changed || createdViews.size() > 0) {
- postProcessRefreshSemantic(createdViews);
- }
- if(createdViews.size() > 1) {
- // perform a layout of the container
- DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
- executeCommand(new ICommandProxy(layoutCmd));
- }
-
- makeViewsImmutable(createdViews);
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateMachineCompartmentItemSemanticEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateMachineCompartmentItemSemanticEditPolicy.java
deleted file mode 100644
index bce8db45e52..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateMachineCompartmentItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.PseudostateEntryPointCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.PseudostateExitPointCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.RegionCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class StateMachineCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public StateMachineCompartmentItemSemanticEditPolicy() {
- super(UMLElementTypes.StateMachine_2000);
- }
-
- /**
- * @generated
- */
- protected Command getCreateCommand(CreateElementRequest req) {
- if(UMLElementTypes.Region_3000 == req.getElementType()) {
- return getGEFWrapper(new RegionCreateCommand(req));
- }
- if(UMLElementTypes.Pseudostate_16000 == req.getElementType()) {
- return getGEFWrapper(new PseudostateEntryPointCreateCommand(req));
- }
- if(UMLElementTypes.Pseudostate_17000 == req.getElementType()) {
- return getGEFWrapper(new PseudostateExitPointCreateCommand(req));
- }
- return super.getCreateCommand(req);
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateMachineItemSemanticEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateMachineItemSemanticEditPolicy.java
deleted file mode 100644
index 22760d4eaba..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/StateMachineItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,259 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
-import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
-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.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.GeneralizationCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.GeneralizationReorientCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.PseudostateEntryPointCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.commands.PseudostateExitPointCreateCommand;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class StateMachineItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public StateMachineItemSemanticEditPolicy() {
- super(UMLElementTypes.StateMachine_2000);
- }
-
- /**
- * @generated
- */
- protected void addDestroyChildNodesCommand(ICompositeCommand cmd) {
- View view = (View)getHost().getModel();
- for(Iterator<?> nit = view.getChildren().iterator(); nit.hasNext();) {
- Node node = (Node)nit.next();
- switch(UMLVisualIDRegistry.getVisualID(node)) {
- case PseudostateEntryPointEditPart.VISUAL_ID:
-
- for(Iterator<?> it = node.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
- break;
- }
- }
-
- for(Iterator<?> it = node.getSourceEdges().iterator(); it.hasNext();) {
- Edge outgoingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(outgoingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
- break;
- }
- }
- cmd.add(new DestroyElementCommand(new DestroyElementRequest(getEditingDomain(), node.getElement(), false))); // directlyOwned: true
- // don't need explicit deletion of node as parent's view deletion would clean child views as well
- // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), node));
- break;
- case PseudostateExitPointEditPart.VISUAL_ID:
-
- for(Iterator<?> it = node.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
- break;
- }
- }
-
- for(Iterator<?> it = node.getSourceEdges().iterator(); it.hasNext();) {
- Edge outgoingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(outgoingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
- break;
- }
- }
- cmd.add(new DestroyElementCommand(new DestroyElementRequest(getEditingDomain(), node.getElement(), false))); // directlyOwned: true
- // don't need explicit deletion of node as parent's view deletion would clean child views as well
- // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), node));
- break;
- case StateMachineCompartmentEditPart.VISUAL_ID:
- for(Iterator<?> cit = node.getChildren().iterator(); cit.hasNext();) {
- Node cnode = (Node)cit.next();
- switch(UMLVisualIDRegistry.getVisualID(cnode)) {
- case RegionEditPart.VISUAL_ID:
-
- cmd.add(new DestroyElementCommand(new DestroyElementRequest(getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
- // don't need explicit deletion of cnode as parent's view deletion would clean child views as well
- // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
- break;
- case PseudostateEntryPointEditPart.VISUAL_ID:
-
- for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
- break;
- }
- }
-
- for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
- Edge outgoingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(outgoingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
- break;
- }
- }
- cmd.add(new DestroyElementCommand(new DestroyElementRequest(getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
- // don't need explicit deletion of cnode as parent's view deletion would clean child views as well
- // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
- break;
- case PseudostateExitPointEditPart.VISUAL_ID:
-
- for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
- break;
- }
- }
-
- for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
- Edge outgoingLink = (Edge)it.next();
- switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
- case TransitionEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(outgoingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
- break;
- }
- }
- cmd.add(new DestroyElementCommand(new DestroyElementRequest(getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
- // don't need explicit deletion of cnode as parent's view deletion would clean child views as well
- // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
- break;
- }
- }
- break;
- }
- }
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Generalization_19000 == req.getElementType()) {
- return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateCommand(CreateElementRequest req) {
- if(UMLElementTypes.Pseudostate_16000 == req.getElementType()) {
- return getGEFWrapper(new PseudostateEntryPointCreateCommand(req));
- }
- if(UMLElementTypes.Pseudostate_17000 == req.getElementType()) {
- return getGEFWrapper(new PseudostateExitPointCreateCommand(req));
- }
- return super.getCreateCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- View view = (View)getHost().getModel();
- CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(true);
-
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if(annotation == null) {
- // there are indirectly referenced children, need extra commands: false
- addDestroyChildNodesCommand(cmd);
- addDestroyShortcutsCommand(cmd, view);
- // delete host element
- List<EObject> todestroy = new ArrayList<EObject>();
- todestroy.add(req.getElementToDestroy());
- //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- cmd.add(new EMFtoGMFCommandWrapper(new org.eclipse.emf.edit.command.DeleteCommand(getEditingDomain(), todestroy)));
- } else {
- cmd.add(new DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch(getVisualID(req)) {
- case GeneralizationEditPart.VISUAL_ID:
- return getGEFWrapper(new GeneralizationReorientCommand(req));
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- if(UMLElementTypes.Generalization_19000 == req.getElementType()) {
- return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
- }
- return null;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/TransitionItemSemanticEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/TransitionItemSemanticEditPolicy.java
deleted file mode 100644
index 376e858cc73..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/TransitionItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.command.DeleteCommand;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class TransitionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public TransitionItemSemanticEditPolicy() {
- super(UMLElementTypes.Transition_7000);
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(true);
- List<EObject> todestroy = new ArrayList<EObject>();
- todestroy.add(req.getElementToDestroy());
- //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- cmd.add(new EMFtoGMFCommandWrapper(new DeleteCommand(getEditingDomain(), todestroy)));
- return getGEFWrapper(cmd.reduce());
- //return getGEFWrapper(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/UMLBaseItemSemanticEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/UMLBaseItemSemanticEditPolicy.java
deleted file mode 100644
index 1621610daaf..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/UMLBaseItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,352 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.edit.policies;
-
-import java.util.Iterator;
-
-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.papyrus.diagram.statemachine.edit.helpers.UMLBaseEditHelper;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.uml2.uml.Classifier;
-import org.eclipse.uml2.uml.Generalization;
-import org.eclipse.uml2.uml.Region;
-import org.eclipse.uml2.uml.Transition;
-import org.eclipse.uml2.uml.Vertex;
-
-/**
- * @generated
- */
-public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
-
- /**
- * @generated
- */
- public static class LinkConstraints {
-
- /**
- * @generated
- */
- public LinkConstraints() {
- // use static method #getLinkConstraints() to access instance
- }
-
- /**
- * @generated
- */
- public boolean canCreateGeneralization_19000(Classifier source, Classifier target) {
- return canExistGeneralization_19000(null, source, target);
- }
-
- /**
- * @generated
- */
- public boolean canCreateTransition_7000(Region container, Vertex source, Vertex target) {
- return canExistTransition_7000(container, null, source, target);
- }
-
- /**
- * @generated
- */
- public boolean canExistGeneralization_19000(Generalization linkInstance, Classifier source, Classifier target) {
- return true;
- }
-
- /**
- * @generated
- */
- public boolean canExistTransition_7000(Region container, Transition linkInstance, Vertex source, Vertex target) {
- return true;
- }
-
- }
-
- /**
- * 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
- */
- public static LinkConstraints getLinkConstraints() {
- LinkConstraints cached = UMLDiagramEditorPlugin.getInstance().getLinkConstraints();
- if(cached == null) {
- UMLDiagramEditorPlugin.getInstance().setLinkConstraints(cached = new LinkConstraints());
- }
- return cached;
- }
-
- /**
- * @generated
- */
- private final IElementType myElementType;
-
- /**
- * @generated
- */
- protected UMLBaseItemSemanticEditPolicy(IElementType elementType) {
- myElementType = elementType;
- }
-
- /**
- * @generated
- */
- protected Command addDeleteViewCommand(Command mainCommand, DestroyRequest completedRequest) {
- Command deleteViewCommand = getGEFWrapper(new DeleteCommand(getEditingDomain(), (View)getHost().getModel()));
- return mainCommand == null ? deleteViewCommand : mainCommand.chain(deleteViewCommand);
- }
-
- /**
- * Clean all shortcuts to the host element from the same diagram
- *
- * @generated
- */
- protected void addDestroyShortcutsCommand(ICompositeCommand cmd, View view) {
- assert view.getEAnnotation("Shortcut") == null; //$NON-NLS-1$
- for(Iterator it = view.getDiagram().getChildren().iterator(); it.hasNext();) {
- 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));
- }
- }
-
- /**
- * 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.
- *
- * @generated
- */
- @SuppressWarnings("unchecked")
- public Command getCommand(Request request) {
- if(request instanceof ReconnectRequest) {
- Object view = ((ReconnectRequest)request).getConnectionEditPart().getModel();
- if(view instanceof View) {
- Integer id = new Integer(UMLVisualIDRegistry.getVisualID((View)view));
- request.getExtendedData().put(VISUAL_ID_KEY, id);
- request.getExtendedData().put(GRAPHICAL_RECONNECTED_EDGE, (View)view);
- }
- }
- return super.getCommand(request);
- }
-
- /**
- * @generated
- */
- protected Command getConfigureCommand(ConfigureRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected IElementType getContextElementType(IEditCommandRequest request) {
- IElementType requestContextElementType = UMLElementTypes.getElementType(getVisualID(request));
- return requestContextElementType != null ? requestContextElementType : myElementType;
- }
-
- /**
- * @generated
- */
- protected Command getCreateCommand(CreateElementRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getDuplicateCommand(DuplicateElementsRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getEditContextCommand(GetEditContextRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- private Command getEditHelperCommand(IEditCommandRequest request, Command editPolicyCommand) {
- if(editPolicyCommand != null) {
- ICommand command = editPolicyCommand instanceof ICommandProxy ? ((ICommandProxy)editPolicyCommand).getICommand() : new CommandProxy(editPolicyCommand);
- request.setParameter(UMLBaseEditHelper.EDIT_POLICY_COMMAND, command);
- }
- IElementType requestContextElementType = getContextElementType(request);
- request.setParameter(UMLBaseEditHelper.CONTEXT_ELEMENT_TYPE, requestContextElementType);
- ICommand command = requestContextElementType.getEditCommand(request);
- request.setParameter(UMLBaseEditHelper.EDIT_POLICY_COMMAND, null);
- request.setParameter(UMLBaseEditHelper.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;
- }
-
- /**
- * Returns editing domain from the host edit part.
- *
- * @generated
- */
- protected TransactionalEditingDomain getEditingDomain() {
- return ((IGraphicalEditPart)getHost()).getEditingDomain();
- }
-
- /**
- * @generated
- */
- protected final Command getGEFWrapper(ICommand cmd) {
- return new ICommandProxy(cmd);
- }
-
- /**
- * @generated
- */
- protected Command getMoveCommand(MoveRequest req) {
-
- return getGEFWrapper(new MoveElementsCommand(req));
-
- }
-
- /**
- * @generated
- */
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- protected Command getSemanticCommand(IEditCommandRequest request) {
- IEditCommandRequest completedRequest = completeRequest(request);
- Command semanticCommand = getSemanticCommandSwitch(completedRequest);
- semanticCommand = getEditHelperCommand(completedRequest, semanticCommand);
- if(completedRequest instanceof DestroyRequest) {
- DestroyRequest destroyRequest = (DestroyRequest)completedRequest;
- return shouldProceed(destroyRequest) ? addDeleteViewCommand(semanticCommand, destroyRequest) : null;
- }
- return semanticCommand;
- }
-
- /**
- * @generated
- */
- protected Command getSemanticCommandSwitch(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 getSetCommand(SetRequest req) {
- return null;
- }
-
- /**
- * Returns visual id from request parameters.
- *
- * @generated
- */
- protected int getVisualID(IEditCommandRequest request) {
- Object id = request.getParameter(VISUAL_ID_KEY);
- return id instanceof Integer ? ((Integer)id).intValue() : -1;
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/UMLTextNonResizableEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/UMLTextNonResizableEditPolicy.java
deleted file mode 100644
index 33299b69ca7..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/UMLTextNonResizableEditPolicy.java
+++ /dev/null
@@ -1,223 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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;
-
-/**
- * @generated
- */
-public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx {
-
- /**
- * @generated
- */
- private IFigure selectionFeedbackFigure;
-
- /**
- * @generated
- */
- private IFigure focusFeedbackFigure;
-
- /**
- * @generated
- */
- private FigureListener hostPositionListener;
-
- /**
- * @generated
- */
- protected IFigure createFocusFeedbackFigure() {
- return new Figure() {
-
- protected void paintFigure(Graphics graphics) {
- graphics.drawFocus(getBounds().getResized(-1, -1));
- }
- };
- }
-
- /**
- * @generated
- */
- protected IFigure createSelectionFeedbackFigure() {
- if(getHostFigure() instanceof Label) {
- Label feedbackFigure = new Label();
- feedbackFigure.setOpaque(true);
- feedbackFigure.setBackgroundColor(ColorConstants.menuBackgroundSelected);
- feedbackFigure.setForegroundColor(ColorConstants.menuForegroundSelected);
- return feedbackFigure;
- } else {
- RectangleFigure feedbackFigure = new RectangleFigure();
- feedbackFigure.setFill(false);
- return feedbackFigure;
- }
- }
-
- /**
- * @generated
- */
- protected List createSelectionHandles() {
- MoveHandle moveHandle = new MoveHandle((GraphicalEditPart)getHost());
- moveHandle.setBorder(null);
- moveHandle.setDragTracker(new DragEditPartsTrackerEx(getHost()));
- return Collections.singletonList(moveHandle);
- }
-
- /**
- * @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
- */
- private FigureListener getHostPositionListener() {
- if(hostPositionListener == null) {
- hostPositionListener = new FigureListener() {
-
- public void figureMoved(IFigure source) {
- refreshFeedback();
- }
- };
- }
- return hostPositionListener;
- }
-
- /**
- * @generated
- */
- protected void hideFocus() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setFocus(false);
- } else {
- if(focusFeedbackFigure != null) {
- removeFeedback(focusFeedbackFigure);
- focusFeedbackFigure = null;
- }
- }
- }
-
- /**
- * @generated
- */
- protected void hideSelection() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setSelected(false);
- ((WrappingLabel)getHostFigure()).setFocus(false);
- } else {
- if(selectionFeedbackFigure != null) {
- removeFeedback(selectionFeedbackFigure);
- getHostFigure().removeFigureListener(getHostPositionListener());
- selectionFeedbackFigure = null;
- }
- hideFocus();
- }
- }
-
- /**
- * @generated
- */
- public void refreshFeedback() {
- refreshSelectionFeedback();
- refreshFocusFeedback();
- }
-
- /**
- * @generated
- */
- protected void refreshFocusFeedback() {
- if(focusFeedbackFigure != null) {
- focusFeedbackFigure.setBounds(getFeedbackBounds());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshSelectionFeedback() {
- if(selectionFeedbackFigure != null) {
- if(selectionFeedbackFigure instanceof Label) {
- updateLabel((Label)selectionFeedbackFigure);
- selectionFeedbackFigure.setBounds(getFeedbackBounds());
- } else {
- selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5));
- }
- }
- }
-
- /**
- * @generated
- */
- protected void showFocus() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setFocus(true);
- } else {
- hideFocus();
- addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
- refreshFocusFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void showPrimarySelection() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setSelected(true);
- ((WrappingLabel)getHostFigure()).setFocus(true);
- } else {
- showSelection();
- showFocus();
- }
- }
-
- /**
- * @generated
- */
- protected void showSelection() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setSelected(true);
- ((WrappingLabel)getHostFigure()).setFocus(false);
- } else {
- hideSelection();
- addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
- getHostFigure().addFigureListener(getHostPositionListener());
- refreshSelectionFeedback();
- hideFocus();
- }
- }
-
- /**
- * @generated
- */
- protected void updateLabel(Label target) {
- Label source = (Label)getHostFigure();
- target.setText(source.getText());
- target.setTextAlignment(source.getTextAlignment());
- target.setFont(source.getFont());
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/UMLTextSelectionEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/UMLTextSelectionEditPolicy.java
deleted file mode 100644
index 7f9e9551eb1..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/edit/policies/UMLTextSelectionEditPolicy.java
+++ /dev/null
@@ -1,207 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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;
-
-/**
- * @generated
- */
-public class UMLTextSelectionEditPolicy extends SelectionEditPolicy {
-
- /**
- * @generated
- */
- private IFigure selectionFeedbackFigure;
-
- /**
- * @generated
- */
- private IFigure focusFeedbackFigure;
-
- /**
- * @generated
- */
- private FigureListener hostPositionListener;
-
- /**
- * @generated
- */
- protected IFigure createFocusFeedbackFigure() {
- return new Figure() {
-
- protected void paintFigure(Graphics graphics) {
- graphics.drawFocus(getBounds().getResized(-1, -1));
- }
- };
- }
-
- /**
- * @generated
- */
- protected IFigure createSelectionFeedbackFigure() {
- if(getHostFigure() instanceof Label) {
- Label feedbackFigure = new Label();
- feedbackFigure.setOpaque(true);
- feedbackFigure.setBackgroundColor(ColorConstants.menuBackgroundSelected);
- feedbackFigure.setForegroundColor(ColorConstants.menuForegroundSelected);
- return feedbackFigure;
- } else {
- RectangleFigure feedbackFigure = new RectangleFigure();
- feedbackFigure.setFill(false);
- return feedbackFigure;
- }
- }
-
- /**
- * @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
- */
- private FigureListener getHostPositionListener() {
- if(hostPositionListener == null) {
- hostPositionListener = new FigureListener() {
-
- public void figureMoved(IFigure source) {
- refreshFeedback();
- }
- };
- }
- return hostPositionListener;
- }
-
- /**
- * @generated
- */
- protected void hideFocus() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setFocus(false);
- } else {
- if(focusFeedbackFigure != null) {
- removeFeedback(focusFeedbackFigure);
- focusFeedbackFigure = null;
- }
- }
- }
-
- /**
- * @generated
- */
- protected void hideSelection() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setSelected(false);
- ((WrappingLabel)getHostFigure()).setFocus(false);
- } else {
- if(selectionFeedbackFigure != null) {
- removeFeedback(selectionFeedbackFigure);
- getHostFigure().removeFigureListener(getHostPositionListener());
- selectionFeedbackFigure = null;
- }
- hideFocus();
- }
- }
-
- /**
- * @generated
- */
- public void refreshFeedback() {
- refreshSelectionFeedback();
- refreshFocusFeedback();
- }
-
- /**
- * @generated
- */
- protected void refreshFocusFeedback() {
- if(focusFeedbackFigure != null) {
- focusFeedbackFigure.setBounds(getFeedbackBounds());
- }
- }
-
- /**
- * @generated
- */
- protected void refreshSelectionFeedback() {
- if(selectionFeedbackFigure != null) {
- if(selectionFeedbackFigure instanceof Label) {
- updateLabel((Label)selectionFeedbackFigure);
- selectionFeedbackFigure.setBounds(getFeedbackBounds());
- } else {
- selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5));
- }
- }
- }
-
- /**
- * @generated
- */
- protected void showFocus() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setFocus(true);
- } else {
- hideFocus();
- addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
- refreshFocusFeedback();
- }
- }
-
- /**
- * @generated
- */
- protected void showPrimarySelection() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setSelected(true);
- ((WrappingLabel)getHostFigure()).setFocus(true);
- } else {
- showSelection();
- showFocus();
- }
- }
-
- /**
- * @generated
- */
- protected void showSelection() {
- if(getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel)getHostFigure()).setSelected(true);
- ((WrappingLabel)getHostFigure()).setFocus(false);
- } else {
- hideSelection();
- addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
- getHostFigure().addFigureListener(getHostPositionListener());
- refreshSelectionFeedback();
- hideFocus();
- }
- }
-
- /**
- * @generated
- */
- protected void updateLabel(Label target) {
- Label source = (Label)getHostFigure();
- target.setText(source.getText());
- target.setTextAlignment(source.getTextAlignment());
- target.setFont(source.getFont());
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLAbstractNavigatorItem.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLAbstractNavigatorItem.java
deleted file mode 100644
index b175a8451d0..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLAbstractNavigatorItem.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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
- */
-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.diagram.statemachine"; //$NON-NLS-1$
- }
- };
- Platform.getAdapterManager().registerAdapters(new IAdapterFactory() {
-
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if(adaptableObject instanceof org.eclipse.papyrus.diagram.statemachine.navigator.UMLAbstractNavigatorItem && adapterType == ITabbedPropertySheetPageContributor.class) {
- return propertySheetPageContributor;
- }
- return null;
- }
-
- public Class[] getAdapterList() {
- return supportedTypes;
- }
- }, org.eclipse.papyrus.diagram.statemachine.navigator.UMLAbstractNavigatorItem.class);
- }
-
- /**
- * @generated
- */
- private Object myParent;
-
- /**
- * @generated
- */
- protected UMLAbstractNavigatorItem(Object parent) {
- myParent = parent;
- }
-
- /**
- * @generated
- */
- public Object getParent() {
- return myParent;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLDomainNavigatorContentProvider.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLDomainNavigatorContentProvider.java
deleted file mode 100644
index 6c54d6f3c7c..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLDomainNavigatorContentProvider.java
+++ /dev/null
@@ -1,217 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.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.util.WorkspaceSynchronizer;
-import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.navigator.ICommonContentExtensionSite;
-import org.eclipse.ui.navigator.ICommonContentProvider;
-
-/**
- * @generated
- */
-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() {
- myAdapterFctoryContentProvier = new AdapterFactoryContentProvider(UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory());
- TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE.createEditingDomain();
- myEditingDomain = (AdapterFactoryEditingDomain)editingDomain;
- myEditingDomain.setResourceToReadOnlyMap(new HashMap() {
-
- public Object get(Object key) {
- if(!containsKey(key)) {
- put(key, Boolean.TRUE);
- }
- return super.get(key);
- }
- });
- myViewerRefreshRunnable = new Runnable() {
-
- public void run() {
- if(myViewer != null) {
- myViewer.refresh();
- }
- }
- };
- myWorkspaceSynchronizer = new WorkspaceSynchronizer(editingDomain, new WorkspaceSynchronizer.Delegate() {
-
- public void dispose() {
- }
-
- public boolean handleResourceChanged(final Resource resource) {
- for(Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
- Resource nextResource = (Resource)it.next();
- nextResource.unload();
- }
- if(myViewer != null) {
- myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable);
- }
- return true;
- }
-
- public boolean handleResourceDeleted(Resource resource) {
- for(Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
- Resource nextResource = (Resource)it.next();
- nextResource.unload();
- }
- if(myViewer != null) {
- myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable);
- }
- return true;
- }
-
- public boolean handleResourceMoved(Resource resource, final URI newURI) {
- for(Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
- Resource nextResource = (Resource)it.next();
- nextResource.unload();
- }
- if(myViewer != null) {
- myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable);
- }
- return true;
- }
- });
- }
-
- /**
- * @generated
- */
- public void dispose() {
- myWorkspaceSynchronizer.dispose();
- myWorkspaceSynchronizer = null;
- myViewerRefreshRunnable = null;
- for(Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
- Resource resource = (Resource)it.next();
- resource.unload();
- }
- ((TransactionalEditingDomain)myEditingDomain).dispose();
- myEditingDomain = null;
- }
-
- /**
- * @generated
- */
- public Object[] getChildren(Object parentElement) {
- if(parentElement instanceof IFile) {
- IFile file = (IFile)parentElement;
- URI fileURI = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
- Resource resource = myEditingDomain.getResourceSet().getResource(fileURI, true);
- return wrapEObjects(myAdapterFctoryContentProvier.getChildren(resource), parentElement);
- }
-
- if(parentElement instanceof UMLDomainNavigatorItem) {
- return wrapEObjects(myAdapterFctoryContentProvier.getChildren(((UMLDomainNavigatorItem)parentElement).getEObject()), parentElement);
- }
- return EMPTY_ARRAY;
- }
-
- /**
- * @generated
- */
- public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
-
- /**
- * @generated
- */
- public Object getParent(Object element) {
- if(element instanceof UMLAbstractNavigatorItem) {
- UMLAbstractNavigatorItem abstractNavigatorItem = (UMLAbstractNavigatorItem)element;
- return abstractNavigatorItem.getParent();
- }
- return null;
- }
-
- /**
- * @generated
- */
- public boolean hasChildren(Object element) {
- return element instanceof IFile || getChildren(element).length > 0;
- }
-
- /**
- * @generated
- */
- public void init(ICommonContentExtensionSite aConfig) {
- }
-
- /**
- * @generated
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- myViewer = viewer;
- }
-
- /**
- * @generated
- */
- public void restoreState(IMemento aMemento) {
- }
-
- /**
- * @generated
- */
- public void saveState(IMemento aMemento) {
- }
-
- /**
- * @generated
- */
- public Object[] wrapEObjects(Object[] objects, Object parentElement) {
- Collection result = new ArrayList();
- for(int i = 0; i < objects.length; i++) {
- if(objects[i] instanceof EObject) {
- result.add(new UMLDomainNavigatorItem((EObject)objects[i], parentElement, myAdapterFctoryContentProvier));
- }
- }
- return result.toArray();
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLDomainNavigatorItem.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLDomainNavigatorItem.java
deleted file mode 100644
index 24fbe46a97a..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLDomainNavigatorItem.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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
- */
-public class UMLDomainNavigatorItem extends PlatformObject {
-
- /**
- * @generated
- */
- static {
- final Class[] supportedTypes = new Class[]{ EObject.class, IPropertySource.class };
- Platform.getAdapterManager().registerAdapters(new IAdapterFactory() {
-
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if(adaptableObject instanceof org.eclipse.papyrus.diagram.statemachine.navigator.UMLDomainNavigatorItem) {
- org.eclipse.papyrus.diagram.statemachine.navigator.UMLDomainNavigatorItem domainNavigatorItem = (org.eclipse.papyrus.diagram.statemachine.navigator.UMLDomainNavigatorItem)adaptableObject;
- 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.diagram.statemachine.navigator.UMLDomainNavigatorItem.class);
- }
-
- /**
- * @generated
- */
- private Object myParent;
-
- /**
- * @generated
- */
- private EObject myEObject;
-
- /**
- * @generated
- */
- private IPropertySourceProvider myPropertySourceProvider;
-
- /**
- * @generated
- */
- public UMLDomainNavigatorItem(EObject eObject, Object parent, IPropertySourceProvider propertySourceProvider) {
- myParent = parent;
- myEObject = eObject;
- myPropertySourceProvider = propertySourceProvider;
- }
-
- /**
- * @generated
- */
- public boolean equals(Object obj) {
- if(obj instanceof org.eclipse.papyrus.diagram.statemachine.navigator.UMLDomainNavigatorItem) {
- return EcoreUtil.getURI(getEObject()).equals(EcoreUtil.getURI(((org.eclipse.papyrus.diagram.statemachine.navigator.UMLDomainNavigatorItem)obj).getEObject()));
- }
- return super.equals(obj);
- }
-
- /**
- * @generated
- */
- public EObject getEObject() {
- return myEObject;
- }
-
- /**
- * @generated
- */
- public Object getParent() {
- return myParent;
- }
-
- /**
- * @generated
- */
- public IPropertySourceProvider getPropertySourceProvider() {
- return myPropertySourceProvider;
- }
-
- /**
- * @generated
- */
- public int hashCode() {
- return EcoreUtil.getURI(getEObject()).hashCode();
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLDomainNavigatorLabelProvider.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLDomainNavigatorLabelProvider.java
deleted file mode 100644
index 768bf87b809..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLDomainNavigatorLabelProvider.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.navigator;
-
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.papyrus.diagram.statemachine.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
- */
-public class UMLDomainNavigatorLabelProvider implements ICommonLabelProvider {
-
- /**
- * @generated
- */
- private AdapterFactoryLabelProvider myAdapterFactoryLabelProvider = new AdapterFactoryLabelProvider(UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory());
-
- /**
- * @generated
- */
- public void addListener(ILabelProviderListener listener) {
- myAdapterFactoryLabelProvider.addListener(listener);
- }
-
- /**
- * @generated
- */
- public void dispose() {
- myAdapterFactoryLabelProvider.dispose();
- }
-
- /**
- * @generated
- */
- public String getDescription(Object anElement) {
- return null;
- }
-
- /**
- * @generated
- */
- public Image getImage(Object element) {
- if(element instanceof UMLDomainNavigatorItem) {
- return myAdapterFactoryLabelProvider.getImage(((UMLDomainNavigatorItem)element).getEObject());
- }
- return null;
- }
-
- /**
- * @generated
- */
- public String getText(Object element) {
- if(element instanceof UMLDomainNavigatorItem) {
- return myAdapterFactoryLabelProvider.getText(((UMLDomainNavigatorItem)element).getEObject());
- }
- return null;
- }
-
- /**
- * @generated
- */
- public void init(ICommonContentExtensionSite aConfig) {
- }
-
- /**
- * @generated
- */
- public boolean isLabelProperty(Object element, String property) {
- return myAdapterFactoryLabelProvider.isLabelProperty(element, property);
- }
-
- /**
- * @generated
- */
- public void removeListener(ILabelProviderListener listener) {
- myAdapterFactoryLabelProvider.removeListener(listener);
- }
-
- /**
- * @generated
- */
- public void restoreState(IMemento aMemento) {
- }
-
- /**
- * @generated
- */
- public void saveState(IMemento aMemento) {
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorActionProvider.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorActionProvider.java
deleted file mode 100644
index cf14162a3e8..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorActionProvider.java
+++ /dev/null
@@ -1,168 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.Messages;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditor;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.diagram.statemachine.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
- */
-public class UMLNavigatorActionProvider extends CommonActionProvider {
-
- /**
- * @generated
- */
- private static class OpenDiagramAction extends Action {
-
- /**
- * @generated
- */
- private static IEditorInput getEditorInput(Diagram diagram) {
- Resource diagramResource = diagram.eResource();
- for(EObject nextEObject : diagramResource.getContents()) {
- if(nextEObject == diagram) {
- return new FileEditorInput(WorkspaceSynchronizer.getFile(diagramResource));
- }
- if(nextEObject instanceof Diagram) {
- break;
- }
- }
- URI uri = EcoreUtil.getURI(diagram);
- String editorName = uri.lastSegment() + '#' + diagram.eResource().getContents().indexOf(diagram);
- IEditorInput editorInput = new URIEditorInput(uri, editorName);
- return editorInput;
- }
-
- /**
- * @generated
- */
- private Diagram myDiagram;
-
- /**
- * @generated
- */
- private ICommonViewerWorkbenchSite myViewerSite;
-
- /**
- * @generated
- */
- public OpenDiagramAction(ICommonViewerWorkbenchSite viewerSite) {
- super(Messages.NavigatorActionProvider_OpenDiagramActionName);
- myViewerSite = viewerSite;
- }
-
- /**
- * @generated
- */
- public void run() {
- if(myDiagram == null || myDiagram.eResource() == null) {
- return;
- }
-
- IEditorInput editorInput = getEditorInput(myDiagram);
- IWorkbenchPage page = myViewerSite.getPage();
- try {
- page.openEditor(editorInput, UMLDiagramEditor.ID);
- } catch (PartInitException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Exception while openning diagram", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public final void selectionChanged(IStructuredSelection selection) {
- 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) {
- Diagram diagram = (Diagram)selectedElement;
- if(PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(diagram))) {
- myDiagram = diagram;
- }
- }
- }
- setEnabled(myDiagram != null);
- }
-
- }
-
- /**
- * @generated
- */
- private boolean myContribute;
-
- /**
- * @generated
- */
- private OpenDiagramAction myOpenDiagramAction;
-
- /**
- * @generated
- */
- public void fillActionBars(IActionBars actionBars) {
- if(!myContribute) {
- return;
- }
- IStructuredSelection selection = (IStructuredSelection)getContext().getSelection();
- myOpenDiagramAction.selectionChanged(selection);
- if(myOpenDiagramAction.isEnabled()) {
- actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, myOpenDiagramAction);
- }
- }
-
- /**
- * @generated
- */
- public void fillContextMenu(IMenuManager menu) {
- }
-
- /**
- * @generated
- */
- public void init(ICommonActionExtensionSite aSite) {
- super.init(aSite);
- if(aSite.getViewSite() instanceof ICommonViewerWorkbenchSite) {
- myContribute = true;
- makeActions((ICommonViewerWorkbenchSite)aSite.getViewSite());
- } else {
- myContribute = false;
- }
- }
-
- /**
- * @generated
- */
- private void makeActions(ICommonViewerWorkbenchSite viewerSite) {
- myOpenDiagramAction = new OpenDiagramAction(viewerSite);
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorContentProvider.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorContentProvider.java
deleted file mode 100644
index 6cf8b0560de..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorContentProvider.java
+++ /dev/null
@@ -1,382 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.navigator;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-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.util.WorkspaceSynchronizer;
-import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
-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.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.navigator.ICommonContentExtensionSite;
-import org.eclipse.ui.navigator.ICommonContentProvider;
-
-/**
- * @generated
- */
-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() {
- TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE.createEditingDomain();
- myEditingDomain = (AdapterFactoryEditingDomain)editingDomain;
- myEditingDomain.setResourceToReadOnlyMap(new HashMap() {
-
- public Object get(Object key) {
- if(!containsKey(key)) {
- put(key, Boolean.TRUE);
- }
- return super.get(key);
- }
- });
- myViewerRefreshRunnable = new Runnable() {
-
- public void run() {
- if(myViewer != null) {
- myViewer.refresh();
- }
- }
- };
- myWorkspaceSynchronizer = new WorkspaceSynchronizer(editingDomain, new WorkspaceSynchronizer.Delegate() {
-
- public void dispose() {
- }
-
- public boolean handleResourceChanged(final Resource resource) {
- for(Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
- Resource nextResource = (Resource)it.next();
- nextResource.unload();
- }
- if(myViewer != null) {
- myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable);
- }
- return true;
- }
-
- public boolean handleResourceDeleted(Resource resource) {
- for(Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
- Resource nextResource = (Resource)it.next();
- nextResource.unload();
- }
- if(myViewer != null) {
- myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable);
- }
- return true;
- }
-
- public boolean handleResourceMoved(Resource resource, final URI newURI) {
- for(Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
- Resource nextResource = (Resource)it.next();
- nextResource.unload();
- }
- if(myViewer != null) {
- myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable);
- }
- return true;
- }
- });
- }
-
- /**
- * @generated
- */
- private Collection createNavigatorItems(Collection views, Object parent, boolean isLeafs) {
- Collection result = new ArrayList();
- for(Iterator it = views.iterator(); it.hasNext();) {
- result.add(new UMLNavigatorItem((View)it.next(), parent, isLeafs));
- }
- return result;
- }
-
- /**
- * @generated
- */
- public void dispose() {
- myWorkspaceSynchronizer.dispose();
- myWorkspaceSynchronizer = null;
- myViewerRefreshRunnable = null;
- for(Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
- Resource resource = (Resource)it.next();
- resource.unload();
- }
- ((TransactionalEditingDomain)myEditingDomain).dispose();
- myEditingDomain = null;
- }
-
- /**
- * @generated
- */
- public Object[] getChildren(Object parentElement) {
- if(parentElement instanceof IFile) {
- IFile file = (IFile)parentElement;
- URI fileURI = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
- Resource resource = myEditingDomain.getResourceSet().getResource(fileURI, true);
- Collection result = new ArrayList();
- result.addAll(createNavigatorItems(selectViewsByType(resource.getContents(), PackageEditPart.MODEL_ID), file, false));
- return result.toArray();
- }
-
- if(parentElement instanceof UMLNavigatorGroup) {
- UMLNavigatorGroup group = (UMLNavigatorGroup)parentElement;
- return group.getChildren();
- }
-
- if(parentElement instanceof UMLNavigatorItem) {
- UMLNavigatorItem navigatorItem = (UMLNavigatorItem)parentElement;
- if(navigatorItem.isLeaf() || !isOwnView(navigatorItem.getView())) {
- return EMPTY_ARRAY;
- }
- return getViewChildren(navigatorItem.getView(), parentElement);
- }
-
- return EMPTY_ARRAY;
- }
-
- /**
- * @generated
- */
- private Collection getChildrenByType(Collection nodes, String type) {
- Collection result = new ArrayList();
- for(Iterator it = nodes.iterator(); it.hasNext();) {
- View nextNode = (View)it.next();
- result.addAll(selectViewsByType(nextNode.getChildren(), type));
- }
- return result;
- }
-
- /**
- * @generated
- */
- private Collection getDiagramLinksByType(Collection diagrams, String type) {
- Collection result = new ArrayList();
- for(Iterator it = diagrams.iterator(); it.hasNext();) {
- Diagram nextDiagram = (Diagram)it.next();
- result.addAll(selectViewsByType(nextDiagram.getEdges(), type));
- }
- return result;
- }
-
- /**
- * @generated
- */
- public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
-
- /**
- * @generated
- */
- private Collection getIncomingLinksByType(Collection nodes, String type) {
- Collection result = new ArrayList();
- for(Iterator it = nodes.iterator(); it.hasNext();) {
- View nextNode = (View)it.next();
- result.addAll(selectViewsByType(nextNode.getTargetEdges(), type));
- }
- return result;
- }
-
- /**
- * @generated
- */
- private Collection getLinksSourceByType(Collection edges, String type) {
- Collection result = new ArrayList();
- for(Iterator it = edges.iterator(); it.hasNext();) {
- Edge nextEdge = (Edge)it.next();
- View nextEdgeSource = nextEdge.getSource();
- if(type.equals(nextEdgeSource.getType()) && isOwnView(nextEdgeSource)) {
- result.add(nextEdgeSource);
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- private Collection getLinksTargetByType(Collection edges, String type) {
- Collection result = new ArrayList();
- for(Iterator it = edges.iterator(); it.hasNext();) {
- Edge nextEdge = (Edge)it.next();
- View nextEdgeTarget = nextEdge.getTarget();
- if(type.equals(nextEdgeTarget.getType()) && isOwnView(nextEdgeTarget)) {
- result.add(nextEdgeTarget);
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- private Collection getOutgoingLinksByType(Collection nodes, String type) {
- Collection result = new ArrayList();
- for(Iterator it = nodes.iterator(); it.hasNext();) {
- View nextNode = (View)it.next();
- result.addAll(selectViewsByType(nextNode.getSourceEdges(), type));
- }
- return result;
- }
-
- /**
- * @generated
- */
- public Object getParent(Object element) {
- if(element instanceof UMLAbstractNavigatorItem) {
- UMLAbstractNavigatorItem abstractNavigatorItem = (UMLAbstractNavigatorItem)element;
- return abstractNavigatorItem.getParent();
- }
- return null;
- }
-
- /**
- * @generated
- */
- private Object[] getViewChildren(View view, Object parentElement) {
- switch(UMLVisualIDRegistry.getVisualID(view)) {
-
- case StateMachineEditPart.VISUAL_ID:
- {
-
- //modification of the template to avoid mistake of 65kb.
- return getViewChildrenForStateMachineEditPart(view, parentElement);
-
- }
-
- case PackageEditPart.VISUAL_ID:
- {
-
- //modification of the template to avoid mistake of 65kb.
- return getViewChildrenForPackageEditPart(view, parentElement);
-
- }
-
- }
- return EMPTY_ARRAY;
- }
-
- /**
- *
- * Papyrus Template this method is a modification of gmf code in order to
- * avoid getViewChidreen() method becoming greater than 64kb.
- *
- * @generated
- **/
- private Object[] getViewChildrenForPackageEditPart(View view, Object parentElement) {
- Collection result = new ArrayList();
- Collection connectedViews = getChildrenByType(Collections.singleton(view), UMLVisualIDRegistry.getType(StateMachineEditPart.VISUAL_ID));
- result.addAll(createNavigatorItems(connectedViews, parentElement, false));
- return result.toArray();
- }
-
- /**
- *
- * Papyrus Template this method is a modification of gmf code in order to
- * avoid getViewChidreen() method becoming greater than 64kb.
- *
- * @generated
- **/
- private Object[] getViewChildrenForStateMachineEditPart(View view, Object parentElement) {
- Collection result = new ArrayList();
- Collection connectedViews = getChildrenByType(Collections.singleton(view), UMLVisualIDRegistry.getType(StateMachineCompartmentEditPart.VISUAL_ID));
- connectedViews = getChildrenByType(connectedViews, UMLVisualIDRegistry.getType(RegionEditPart.VISUAL_ID));
- result.addAll(createNavigatorItems(connectedViews, parentElement, false));
- return result.toArray();
- }
-
- /**
- * @generated
- */
- public boolean hasChildren(Object element) {
- return element instanceof IFile || getChildren(element).length > 0;
- }
-
- /**
- * @generated
- */
- public void init(ICommonContentExtensionSite aConfig) {
- }
-
- /**
- * @generated
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- myViewer = viewer;
- }
-
- /**
- * @generated
- */
- private boolean isOwnView(View view) {
- return PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view));
- }
-
- /**
- * @generated
- */
- public void restoreState(IMemento aMemento) {
- }
-
- /**
- * @generated
- */
- public void saveState(IMemento aMemento) {
- }
-
- /**
- * @generated
- */
- private Collection selectViewsByType(Collection views, String type) {
- Collection result = new ArrayList();
- for(Iterator it = views.iterator(); it.hasNext();) {
- View nextView = (View)it.next();
- if(type.equals(nextView.getType()) && isOwnView(nextView)) {
- result.add(nextView);
- }
- }
- return result;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorGroup.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorGroup.java
deleted file mode 100644
index 178ca7b4249..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorGroup.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.navigator;
-
-import java.util.Collection;
-import java.util.LinkedList;
-
-/**
- * @generated
- */
-public class UMLNavigatorGroup extends UMLAbstractNavigatorItem {
-
- /**
- * @generated
- */
- private String myGroupName;
-
- /**
- * @generated
- */
- private String myIcon;
-
- /**
- * @generated
- */
- private Collection myChildren = new LinkedList();
-
- /**
- * @generated
- */
- UMLNavigatorGroup(String groupName, String icon, Object parent) {
- super(parent);
- myGroupName = groupName;
- myIcon = icon;
- }
-
- /**
- * @generated
- */
- public void addChild(Object child) {
- myChildren.add(child);
- }
-
- /**
- * @generated
- */
- public void addChildren(Collection children) {
- myChildren.addAll(children);
- }
-
- /**
- * @generated
- */
- public boolean equals(Object obj) {
- if(obj instanceof org.eclipse.papyrus.diagram.statemachine.navigator.UMLNavigatorGroup) {
- org.eclipse.papyrus.diagram.statemachine.navigator.UMLNavigatorGroup anotherGroup = (org.eclipse.papyrus.diagram.statemachine.navigator.UMLNavigatorGroup)obj;
- if(getGroupName().equals(anotherGroup.getGroupName())) {
- return getParent().equals(anotherGroup.getParent());
- }
- }
- return super.equals(obj);
- }
-
- /**
- * @generated
- */
- public Object[] getChildren() {
- return myChildren.toArray();
- }
-
- /**
- * @generated
- */
- public String getGroupName() {
- return myGroupName;
- }
-
- /**
- * @generated
- */
- public String getIcon() {
- return myIcon;
- }
-
- /**
- * @generated
- */
- public int hashCode() {
- return getGroupName().hashCode();
- }
-
- /**
- * @generated
- */
- public boolean isEmpty() {
- return myChildren.size() == 0;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorItem.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorItem.java
deleted file mode 100644
index 44aa50088d7..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorItem.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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
- */
-public class UMLNavigatorItem extends UMLAbstractNavigatorItem {
-
- /**
- * @generated
- */
- static {
- final Class[] supportedTypes = new Class[]{ View.class, EObject.class };
- Platform.getAdapterManager().registerAdapters(new IAdapterFactory() {
-
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if(adaptableObject instanceof org.eclipse.papyrus.diagram.statemachine.navigator.UMLNavigatorItem && (adapterType == View.class || adapterType == EObject.class)) {
- return ((org.eclipse.papyrus.diagram.statemachine.navigator.UMLNavigatorItem)adaptableObject).getView();
- }
- return null;
- }
-
- public Class[] getAdapterList() {
- return supportedTypes;
- }
- }, org.eclipse.papyrus.diagram.statemachine.navigator.UMLNavigatorItem.class);
- }
-
- /**
- * @generated
- */
- private View myView;
-
- /**
- * @generated
- */
- private boolean myLeaf = false;
-
- /**
- * @generated
- */
- public UMLNavigatorItem(View view, Object parent, boolean isLeaf) {
- super(parent);
- myView = view;
- myLeaf = isLeaf;
- }
-
- /**
- * @generated
- */
- public boolean equals(Object obj) {
- if(obj instanceof org.eclipse.papyrus.diagram.statemachine.navigator.UMLNavigatorItem) {
- return EcoreUtil.getURI(getView()).equals(EcoreUtil.getURI(((org.eclipse.papyrus.diagram.statemachine.navigator.UMLNavigatorItem)obj).getView()));
- }
- return super.equals(obj);
- }
-
- /**
- * @generated
- */
- public View getView() {
- return myView;
- }
-
- /**
- * @generated
- */
- public int hashCode() {
- return EcoreUtil.getURI(getView()).hashCode();
- }
-
- /**
- * @generated
- */
- public boolean isLeaf() {
- return myLeaf;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorLabelProvider.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorLabelProvider.java
deleted file mode 100644
index 4c1c953c2b1..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorLabelProvider.java
+++ /dev/null
@@ -1,230 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.navigator;
-
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-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.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLParserProvider;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.navigator.ICommonContentExtensionSite;
-import org.eclipse.ui.navigator.ICommonLabelProvider;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.Region;
-
-/**
- * @generated
- */
-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 String getDescription(Object anElement) {
- return null;
- }
-
- /**
- * @generated
- */
- public Image getImage(Object element) {
- if(element instanceof UMLNavigatorGroup) {
- UMLNavigatorGroup group = (UMLNavigatorGroup)element;
- return UMLDiagramEditorPlugin.getInstance().getBundledImage(group.getIcon());
- }
-
- if(element instanceof UMLNavigatorItem) {
- UMLNavigatorItem navigatorItem = (UMLNavigatorItem)element;
- if(!isOwnView(navigatorItem.getView())) {
- return super.getImage(element);
- }
- return getImage(navigatorItem.getView());
- }
-
- return super.getImage(element);
- }
-
- /**
- * @generated
- */
- private Image getImage(String key, IElementType elementType) {
- 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
- */
- public Image getImage(View view) {
- switch(UMLVisualIDRegistry.getVisualID(view)) {
- case StateMachineEditPart.VISUAL_ID:
- return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/3.0.0/UML?StateMachine", UMLElementTypes.StateMachine_2000); //$NON-NLS-1$
- case PackageEditPart.VISUAL_ID:
- return getImage("Navigator?Diagram?http://www.eclipse.org/uml2/3.0.0/UML?Package", UMLElementTypes.Package_1000); //$NON-NLS-1$
- case RegionEditPart.VISUAL_ID:
- return getImage("Navigator?Node?http://www.eclipse.org/uml2/3.0.0/UML?Region", UMLElementTypes.Region_3000); //$NON-NLS-1$
- }
- return getImage("Navigator?UnknownElement", null); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- private String getPackage_1000Text(View view) {
- Package domainModelElement = (Package)view.getElement();
- if(domainModelElement != null) {
- return String.valueOf(domainModelElement.getName());
- } else {
- UMLDiagramEditorPlugin.getInstance().logError("No domain element for view with visualID = " + 1000); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getRegion_3000Text(View view) {
- Region domainModelElement = (Region)view.getElement();
- if(domainModelElement != null) {
- return String.valueOf(domainModelElement.getName());
- } else {
- UMLDiagramEditorPlugin.getInstance().logError("No domain element for view with visualID = " + 3000); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String getStateMachine_2000Text(View view) {
- IParser parser = UMLParserProvider.getParser(UMLElementTypes.StateMachine_2000, view.getElement() != null ? view.getElement() : view, UMLVisualIDRegistry.getType(StateMachineNameEditPart.VISUAL_ID));
- if(parser != null) {
- return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), ParserOptions.NONE.intValue());
- } else {
- UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 2001); //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public String getText(Object element) {
- if(element instanceof UMLNavigatorGroup) {
- UMLNavigatorGroup group = (UMLNavigatorGroup)element;
- return group.getGroupName();
- }
-
- if(element instanceof UMLNavigatorItem) {
- UMLNavigatorItem navigatorItem = (UMLNavigatorItem)element;
- if(!isOwnView(navigatorItem.getView())) {
- return null;
- }
- return getText(navigatorItem.getView());
- }
-
- return super.getText(element);
- }
-
- /**
- * @generated
- */
- public String getText(View view) {
- if(view.getElement() != null && view.getElement().eIsProxy()) {
- return getUnresolvedDomainElementProxyText(view);
- }
- switch(UMLVisualIDRegistry.getVisualID(view)) {
- case StateMachineEditPart.VISUAL_ID:
- return getStateMachine_2000Text(view);
- case PackageEditPart.VISUAL_ID:
- return getPackage_1000Text(view);
- case RegionEditPart.VISUAL_ID:
- return getRegion_3000Text(view);
- }
- return getUnknownElementText(view);
- }
-
- /**
- * @generated
- */
- private String getUnknownElementText(View view) {
- return "<UnknownElement Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * @generated
- */
- private String getUnresolvedDomainElementProxyText(View view) {
- return "<Unresolved domain element Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * @generated
- */
- public void init(ICommonContentExtensionSite aConfig) {
- }
-
- /**
- * @generated
- */
- private boolean isOwnView(View view) {
- return PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view));
- }
-
- /**
- * @generated
- */
- public void restoreState(IMemento aMemento) {
- }
-
- /**
- * @generated
- */
- public void saveState(IMemento aMemento) {
- }
-
- /**
- * @generated
- */
- public void updateLabel(ViewerLabel label, TreePath elementPath) {
- Object element = elementPath.getLastSegment();
- if(element instanceof UMLNavigatorItem && !isOwnView(((UMLNavigatorItem)element).getView())) {
- return;
- }
- label.setText(getText(element));
- label.setImage(getImage(element));
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorLinkHelper.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorLinkHelper.java
deleted file mode 100644
index 1f91ac4a63a..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorLinkHelper.java
+++ /dev/null
@@ -1,115 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.navigator;
-
-import org.eclipse.core.resources.IFile;
-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.diagram.statemachine.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
- */
-public class UMLNavigatorLinkHelper implements ILinkHelper {
-
- /**
- * @generated
- */
- private static IEditorInput getEditorInput(Diagram diagram) {
- Resource diagramResource = diagram.eResource();
- for(EObject nextEObject : diagramResource.getContents()) {
- if(nextEObject == diagram) {
- return new FileEditorInput(WorkspaceSynchronizer.getFile(diagramResource));
- }
- if(nextEObject instanceof Diagram) {
- break;
- }
- }
- URI uri = EcoreUtil.getURI(diagram);
- String editorName = uri.lastSegment() + '#' + diagram.eResource().getContents().indexOf(diagram);
- IEditorInput editorInput = new URIEditorInput(uri, editorName);
- return editorInput;
- }
-
- /**
- * @generated
- */
- public void activateEditor(IWorkbenchPage aPage, IStructuredSelection aSelection) {
- if(aSelection == null || aSelection.isEmpty()) {
- return;
- }
- if(false == aSelection.getFirstElement() instanceof UMLAbstractNavigatorItem) {
- return;
- }
-
- UMLAbstractNavigatorItem abstractNavigatorItem = (UMLAbstractNavigatorItem)aSelection.getFirstElement();
- View navigatorView = null;
- if(abstractNavigatorItem instanceof UMLNavigatorItem) {
- navigatorView = ((UMLNavigatorItem)abstractNavigatorItem).getView();
- } else if(abstractNavigatorItem instanceof UMLNavigatorGroup) {
- UMLNavigatorGroup navigatorGroup = (UMLNavigatorGroup)abstractNavigatorItem;
- if(navigatorGroup.getParent() instanceof UMLNavigatorItem) {
- navigatorView = ((UMLNavigatorItem)navigatorGroup.getParent()).getView();
- }
- }
- if(navigatorView == null) {
- return;
- }
- IEditorInput editorInput = getEditorInput(navigatorView.getDiagram());
- IEditorPart editor = aPage.findEditor(editorInput);
- if(editor == null) {
- return;
- }
- aPage.bringToTop(editor);
- if(editor instanceof DiagramEditor) {
- DiagramEditor diagramEditor = (DiagramEditor)editor;
- ResourceSet diagramEditorResourceSet = diagramEditor.getEditingDomain().getResourceSet();
- EObject selectedView = diagramEditorResourceSet.getEObject(EcoreUtil.getURI(navigatorView), true);
- if(selectedView == null) {
- return;
- }
- GraphicalViewer graphicalViewer = (GraphicalViewer)diagramEditor.getAdapter(GraphicalViewer.class);
- EditPart selectedEditPart = (EditPart)graphicalViewer.getEditPartRegistry().get(selectedView);
- if(selectedEditPart != null) {
- graphicalViewer.select(selectedEditPart);
- }
- }
- }
-
- /**
- * @generated
- */
- public IStructuredSelection findSelection(IEditorInput anInput) {
- IDiagramDocument document = UMLDiagramEditorPlugin.getInstance().getDocumentProvider().getDiagramDocument(anInput);
- if(document == null) {
- return StructuredSelection.EMPTY;
- }
- Diagram diagram = document.getDiagram();
- if(diagram == null || diagram.eResource() == null) {
- return StructuredSelection.EMPTY;
- }
- IFile file = WorkspaceSynchronizer.getFile(diagram.eResource());
- if(file != null) {
- UMLNavigatorItem item = new UMLNavigatorItem(diagram, file, false);
- return new StructuredSelection(item);
- }
- return StructuredSelection.EMPTY;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorSorter.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorSorter.java
deleted file mode 100644
index 529ef9fefd5..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/navigator/UMLNavigatorSorter.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.navigator;
-
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-
-/**
- * @generated
- */
-public class UMLNavigatorSorter extends ViewerSorter {
-
- /**
- * @generated
- */
- private static final int GROUP_CATEGORY = 19002;
-
- /**
- * @generated
- */
- public int category(Object element) {
- if(element instanceof UMLNavigatorItem) {
- UMLNavigatorItem item = (UMLNavigatorItem)element;
- return UMLVisualIDRegistry.getVisualID(item.getView());
- }
- return GROUP_CATEGORY;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/parsers/AbstractParser.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/parsers/AbstractParser.java
deleted file mode 100644
index fb71d20142e..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/parsers/AbstractParser.java
+++ /dev/null
@@ -1,418 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.diagram.statemachine.part.Messages;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public abstract class AbstractParser implements IParser {
-
- /**
- * @generated
- */
- protected class InvalidValue {
-
- /**
- * @generated
- */
- private String description;
-
- /**
- * @generated
- */
- public InvalidValue(String description) {
- this.description = description;
- }
-
- /**
- * @generated
- */
- public String toString() {
- return description;
- }
- }
-
- /**
- * @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(EAttribute[] features) {
- if(features == null || Arrays.asList(features).contains(null)) {
- throw new IllegalArgumentException();
- }
- this.editableFeatures = this.features = features;
- }
-
- /**
- * @generated
- */
- public AbstractParser(EAttribute[] features, 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 IContentAssistProcessor getCompletionProcessor(IAdaptable element) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Object[] getEditableValues(EObject element) {
- Object[] values = new Object[editableFeatures.length];
- for(int i = 0; i < editableFeatures.length; i++) {
- values[i] = getValue(element, editableFeatures[i]);
- }
- return values;
- }
-
- /**
- * @generated
- */
- public String getEditorPattern() {
- return editorPattern;
- }
-
- /**
- * @generated
- */
- public String getEditPattern() {
- return editPattern;
- }
-
- /**
- * @generated
- */
- protected ICommand getModificationCommand(EObject element, EAttribute feature, Object value) {
- value = getValidNewValue(feature, value);
- if(value instanceof InvalidValue) {
- return UnexecutableCommand.INSTANCE;
- }
- SetRequest request = new SetRequest(element, feature, value);
- return new SetValueCommand(request);
- }
-
- /**
- * @generated
- */
- protected ICommand getParseCommand(IAdaptable adapter, Object[] values, int flags) {
- if(values == null || validateNewValues(values).getCode() != IParserEditStatus.EDITABLE) {
- return UnexecutableCommand.INSTANCE;
- }
- EObject element = (EObject)adapter.getAdapter(EObject.class);
- TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(element);
- if(editingDomain == null) {
- return UnexecutableCommand.INSTANCE;
- }
- CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Set Values"); //$NON-NLS-1$
- for(int i = 0; i < values.length; i++) {
- command.compose(getModificationCommand(element, editableFeatures[i], values[i]));
- }
- return command;
- }
-
- /**
- * @generated
- */
- protected Object getValidNewValue(EAttribute feature, Object value) {
- EClassifier type = feature.getEType();
- if(type instanceof EDataType) {
- 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) {
- 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) {
- String s = (String)value;
- if(s.length() == 0) {
- value = null;
- } else {
- try {
- value = Byte.valueOf(s);
- } catch (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) {
- String s = (String)value;
- if(s.length() == 0) {
- value = null;
- } else {
- try {
- value = Short.valueOf(s);
- } catch (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) {
- String s = (String)value;
- if(s.length() == 0) {
- value = null;
- } else {
- try {
- value = Integer.valueOf(s);
- } catch (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) {
- String s = (String)value;
- if(s.length() == 0) {
- value = null;
- } else {
- try {
- value = Long.valueOf(s);
- } catch (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) {
- String s = (String)value;
- if(s.length() == 0) {
- value = null;
- } else {
- try {
- value = Float.valueOf(s);
- } catch (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) {
- String s = (String)value;
- if(s.length() == 0) {
- value = null;
- } else {
- try {
- value = Double.valueOf(s);
- } catch (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) {
- 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 Object getValue(EObject element, EAttribute feature) {
- Object value = element.eGet(feature);
- Class iClass = feature.getEAttributeType().getInstanceClass();
- if(String.class.equals(iClass)) {
- if(value == null) {
- value = ""; //$NON-NLS-1$
- }
- }
- return value;
- }
-
- /**
- * @generated
- */
- protected Object[] getValues(EObject element) {
- Object[] values = new Object[features.length];
- for(int i = 0; i < features.length; i++) {
- values[i] = getValue(element, features[i]);
- }
- return values;
- }
-
- /**
- * @generated
- */
- public String getViewPattern() {
- return viewPattern;
- }
-
- /**
- * @generated
- */
- public boolean isAffectingEvent(Object event, int flags) {
- if(event instanceof Notification) {
- return isAffectingFeature(((Notification)event).getFeature());
- }
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean isAffectingFeature(Object feature) {
- for(int i = 0; i < features.length; i++) {
- if(features[i] == feature) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * @generated
- */
- public void setEditorPattern(String editorPattern) {
- this.editorPattern = editorPattern;
- }
-
- /**
- * @generated
- */
- public void setEditPattern(String editPattern) {
- this.editPattern = editPattern;
- }
-
- /**
- * @generated
- */
- public void setViewPattern(String viewPattern) {
- this.viewPattern = viewPattern;
- }
-
- /**
- * @generated
- */
- protected IParserEditStatus validateNewValues(Object[] values) {
- if(values.length != editableFeatures.length) {
- return ParserEditStatus.UNEDITABLE_STATUS;
- }
- for(int i = 0; i < values.length; i++) {
- Object value = getValidNewValue(editableFeatures[i], values[i]);
- if(value instanceof InvalidValue) {
- return new ParserEditStatus(UMLDiagramEditorPlugin.ID, IParserEditStatus.UNEDITABLE, value.toString());
- }
- }
- return ParserEditStatus.EDITABLE_STATUS;
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/parsers/MessageFormatParser.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/parsers/MessageFormatParser.java
deleted file mode 100644
index f2e0b4b9502..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/parsers/MessageFormatParser.java
+++ /dev/null
@@ -1,189 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.diagram.statemachine.part.Messages;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-
-/**
- * @generated
- */
-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(EAttribute[] features) {
- super(features);
- }
-
- /**
- * @generated
- */
- public MessageFormatParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- /**
- * @generated
- */
- protected String getDefaultEditablePattern() {
- if(defaultEditablePattern == null) {
- StringBuffer sb = new StringBuffer();
- for(int i = 0; i < editableFeatures.length; i++) {
- if(i > 0) {
- sb.append(' ');
- }
- sb.append('{');
- sb.append(i);
- sb.append('}');
- }
- defaultEditablePattern = sb.toString();
- }
- return defaultEditablePattern;
- }
-
- /**
- * @generated
- */
- protected String getDefaultPattern() {
- if(defaultPattern == null) {
- StringBuffer sb = new StringBuffer();
- for(int i = 0; i < features.length; i++) {
- if(i > 0) {
- sb.append(' ');
- }
- sb.append('{');
- sb.append(i);
- sb.append('}');
- }
- defaultPattern = sb.toString();
- }
- return defaultPattern;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getEditorProcessor() {
- if(editorProcessor == null) {
- editorProcessor = new MessageFormat(getEditorPattern() == null ? getDefaultEditablePattern() : getEditorPattern());
- }
- return editorProcessor;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getEditProcessor() {
- if(editProcessor == null) {
- editProcessor = new MessageFormat(getEditPattern() == null ? getDefaultEditablePattern() : getEditPattern());
- }
- return editProcessor;
- }
-
- /**
- * @generated
- */
- public String getEditString(IAdaptable adapter, int flags) {
- EObject element = (EObject)adapter.getAdapter(EObject.class);
- return getEditorProcessor().format(getEditableValues(element), new StringBuffer(), new FieldPosition(0)).toString();
- }
-
- /**
- * @generated
- */
- public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) {
- Object[] values = getEditProcessor().parse(newString, new ParsePosition(0));
- return getParseCommand(adapter, values, flags);
- }
-
- /**
- * @generated
- */
- public String getPrintString(IAdaptable adapter, int flags) {
- EObject element = (EObject)adapter.getAdapter(EObject.class);
- return getViewProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString();
- }
-
- /**
- * @generated
- */
- protected MessageFormat getViewProcessor() {
- if(viewProcessor == null) {
- viewProcessor = new MessageFormat(getViewPattern() == null ? getDefaultPattern() : getViewPattern());
- }
- return viewProcessor;
- }
-
- /**
- * @generated
- */
- public IParserEditStatus isValidEditString(IAdaptable adapter, String editString) {
- ParsePosition pos = new ParsePosition(0);
- 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 void setEditorPattern(String editorPattern) {
- super.setEditorPattern(editorPattern);
- editorProcessor = null;
- }
-
- /**
- * @generated
- */
- public void setEditPattern(String editPattern) {
- super.setEditPattern(editPattern);
- editProcessor = null;
- }
-
- /**
- * @generated
- */
- public void setViewPattern(String viewPattern) {
- super.setViewPattern(viewPattern);
- viewProcessor = null;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/DeleteElementAction.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/DeleteElementAction.java
deleted file mode 100644
index f36e10a3fab..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/DeleteElementAction.java
+++ /dev/null
@@ -1,3 +0,0 @@
-//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/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/DiagramEditorContextMenuProvider.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/DiagramEditorContextMenuProvider.java
deleted file mode 100644
index 807638910d0..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/DiagramEditorContextMenuProvider.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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
- */
-public class DiagramEditorContextMenuProvider extends DiagramContextMenuProvider {
-
- /**
- * @generated
- */
- private IWorkbenchPart part;
-
- /**
- * @generated
- */
- public DiagramEditorContextMenuProvider(IWorkbenchPart part, EditPartViewer viewer) {
- super(part, viewer);
- this.part = part;
-
- }
-
- /**
- * @generated
- */
- 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, part);
- menu.remove(ActionIds.ACTION_DELETE_FROM_MODEL);
-
- }
- });
- } catch (Exception e) {
- UMLDiagramEditorPlugin.getInstance().logError("Error building context menu", e);
- }
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/LoadResourceAction.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/LoadResourceAction.java
deleted file mode 100644
index efcb2263aa2..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/LoadResourceAction.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.part;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * @generated
- */
-public class LoadResourceAction extends AbstractHandler {
-
- /**
- * @generated
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IEditorPart diagramEditor = HandlerUtil.getActiveEditorChecked(event);
- Shell shell = diagramEditor.getEditorSite().getShell();
- assert diagramEditor instanceof DiagramEditor;
- TransactionalEditingDomain editingDomain = ((DiagramEditor)diagramEditor).getEditingDomain();
- org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog loadResourceDialog = new org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog(shell, editingDomain);
- loadResourceDialog.open();
- return null;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/Messages.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/Messages.java
deleted file mode 100644
index 3835667d769..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/Messages.java
+++ /dev/null
@@ -1,459 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.part;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * @generated
- */
-public class Messages extends NLS {
-
- /**
- * @generated
- */
- static {
- NLS.initializeMessages("messages", Messages.class); //$NON-NLS-1$
- }
-
- /**
- * @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 createRegionCreationTool_title;
-
- /**
- * @generated
- */
- public static String createRegionCreationTool_desc;
-
- /**
- * @generated
- */
- public static String createStateCreationTool_title;
-
- /**
- * @generated
- */
- public static String createStateCreationTool_desc;
-
- /**
- * @generated
- */
- public static String createInitialCreationTool_title;
-
- /**
- * @generated
- */
- public static String createInitialCreationTool_desc;
-
- /**
- * @generated
- */
- public static String createFinalStateCreationTool_title;
-
- /**
- * @generated
- */
- public static String createFinalStateCreationTool_desc;
-
- /**
- * @generated
- */
- public static String createShallowHistoryCreationTool_title;
-
- /**
- * @generated
- */
- public static String createShallowHistoryCreationTool_desc;
-
- /**
- * @generated
- */
- public static String createDeepHistoryCreationTool_title;
-
- /**
- * @generated
- */
- public static String createDeepHistoryCreationTool_desc;
-
- /**
- * @generated
- */
- public static String createForkCreationTool_title;
-
- /**
- * @generated
- */
- public static String createForkCreationTool_desc;
-
- /**
- * @generated
- */
- public static String createJoinCreationTool_title;
-
- /**
- * @generated
- */
- public static String createJoinCreationTool_desc;
-
- /**
- * @generated
- */
- public static String createChoiceCreationTool_title;
-
- /**
- * @generated
- */
- public static String createChoiceCreationTool_desc;
-
- /**
- * @generated
- */
- public static String createJunctionCreationTool_title;
-
- /**
- * @generated
- */
- public static String createJunctionCreationTool_desc;
-
- /**
- * @generated
- */
- public static String createEntryPointCreationTool_title;
-
- /**
- * @generated
- */
- public static String createEntryPointCreationTool_desc;
-
- /**
- * @generated
- */
- public static String createExitPointCreationTool_title;
-
- /**
- * @generated
- */
- public static String createExitPointCreationTool_desc;
-
- /**
- * @generated
- */
- public static String createTerminateCreationTool_title;
-
- /**
- * @generated
- */
- public static String createTerminateCreationTool_desc;
-
- /**
- * @generated
- */
- public static String createConnectionPointReferenceCreationTool_title;
-
- /**
- * @generated
- */
- public static String createConnectionPointReferenceCreationTool_desc;
-
- /**
- * @generated
- */
- public static String createTransitionCreationTool_title;
-
- /**
- * @generated
- */
- public static String createTransitionCreationTool_desc;
-
- /**
- * @generated
- */
- public static String RegionCompartmentEditPart_title;
-
- /**
- * @generated
- */
- public static String StateMachineCompartmentEditPart_title;
-
- /**
- * @generated
- */
- public static String StateCompartmentEditPart_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;
-
- /**
- * @generated
- */
- private Messages() {
- }
-
- // TODO: put accessor fields manually
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/ModelElementSelectionPage.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/ModelElementSelectionPage.java
deleted file mode 100644
index dd80772c0fb..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/ModelElementSelectionPage.java
+++ /dev/null
@@ -1,143 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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
- */
-public class ModelElementSelectionPage extends WizardPage {
-
- /**
- * @generated
- */
- protected EObject selectedModelElement;
-
- /**
- * @generated
- */
- private TreeViewer modelViewer;
-
- /**
- * @generated
- */
- public ModelElementSelectionPage(String pageName) {
- super(pageName);
- }
-
- /**
- * @generated
- */
- public void createControl(Composite parent) {
- initializeDialogUnits(parent);
-
- Composite plate = new Composite(parent, SWT.NONE);
- plate.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- plate.setLayout(layout);
- setControl(plate);
-
- Label label = new Label(plate, SWT.NONE);
- label.setText(getSelectionTitle());
- label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
- modelViewer = new TreeViewer(plate, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- GridData layoutData = new GridData(GridData.FILL_BOTH);
- layoutData.heightHint = 300;
- layoutData.widthHint = 300;
- modelViewer.getTree().setLayoutData(layoutData);
- modelViewer.setContentProvider(new AdapterFactoryContentProvider(UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory()));
- modelViewer.setLabelProvider(new AdapterFactoryLabelProvider(UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory()));
- if(selectedModelElement != null) {
- modelViewer.setInput(selectedModelElement.eResource());
- modelViewer.setSelection(new StructuredSelection(selectedModelElement));
- }
- modelViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- public void selectionChanged(SelectionChangedEvent event) {
- ModelElementSelectionPage.this.updateSelection((IStructuredSelection)event.getSelection());
- }
- });
-
- setPageComplete(validatePage());
- }
-
- /**
- * @generated
- */
- public EObject getModelElement() {
- return selectedModelElement;
- }
-
- /**
- * Override to provide custom model element description.
- *
- * @generated
- */
- protected String getSelectionTitle() {
- return Messages.ModelElementSelectionPageMessage;
- }
-
- /**
- * @generated
- */
- public void setModelElement(EObject modelElement) {
- selectedModelElement = modelElement;
- if(modelViewer != null) {
- if(selectedModelElement != null) {
- modelViewer.setInput(selectedModelElement.eResource());
- modelViewer.setSelection(new StructuredSelection(selectedModelElement));
- } else {
- modelViewer.setInput(null);
- }
- setPageComplete(validatePage());
- }
- }
-
- /**
- * @generated
- */
- protected void updateSelection(IStructuredSelection selection) {
- 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) {
- 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/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLCreationWizard.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLCreationWizard.java
deleted file mode 100644
index 40ec75fc1de..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLCreationWizard.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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
- */
-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 void addPages() {
- diagramModelFilePage = new UMLCreationWizardPage("DiagramModelFile", getSelection(), "PapyrusUMLStateMachine_diagram"); //$NON-NLS-1$ //$NON-NLS-2$
- diagramModelFilePage.setTitle(Messages.UMLCreationWizard_DiagramModelFilePageTitle);
- diagramModelFilePage.setDescription(Messages.UMLCreationWizard_DiagramModelFilePageDescription);
- addPage(diagramModelFilePage);
-
- domainModelFilePage = new UMLCreationWizardPage("DomainModelFile", getSelection(), "PapyrusUMLStateMachine") { //$NON-NLS-1$ //$NON-NLS-2$
-
- public void setVisible(boolean visible) {
- if(visible) {
- String fileName = diagramModelFilePage.getFileName();
- fileName = fileName.substring(0, fileName.length() - ".PapyrusUMLStateMachine_diagram".length()); //$NON-NLS-1$
- setFileName(UMLDiagramEditorUtil.getUniqueFileName(getContainerFullPath(), fileName, "PapyrusUMLStateMachine")); //$NON-NLS-1$
- }
- super.setVisible(visible);
- }
- };
- domainModelFilePage.setTitle(Messages.UMLCreationWizard_DomainModelFilePageTitle);
- domainModelFilePage.setDescription(Messages.UMLCreationWizard_DomainModelFilePageDescription);
- addPage(domainModelFilePage);
- }
-
- /**
- * @generated
- */
- public final Resource getDiagram() {
- return diagram;
- }
-
- /**
- * @generated
- */
- public IStructuredSelection getSelection() {
- return selection;
- }
-
- /**
- * @generated
- */
- public IWorkbench getWorkbench() {
- return workbench;
- }
-
- /**
- * @generated
- */
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- this.workbench = workbench;
- this.selection = selection;
- setWindowTitle(Messages.UMLCreationWizardTitle);
- setDefaultPageImageDescriptor(UMLDiagramEditorPlugin.getBundledImageDescriptor("icons/wizban/NewUMLWizard.gif")); //$NON-NLS-1$
- setNeedsProgressMonitor(true);
- }
-
- /**
- * @generated
- */
- public final boolean isOpenNewlyCreatedDiagramEditor() {
- return openNewlyCreatedDiagramEditor;
- }
-
- /**
- * @generated
- */
- public boolean performFinish() {
- IRunnableWithProgress op = new WorkspaceModifyOperation(null) {
-
- protected void execute(IProgressMonitor monitor) throws CoreException, InterruptedException {
- diagram = UMLDiagramEditorUtil.createDiagram(diagramModelFilePage.getURI(), domainModelFilePage.getURI(), monitor);
- if(isOpenNewlyCreatedDiagramEditor() && diagram != null) {
- try {
- UMLDiagramEditorUtil.openDiagram(diagram);
- } catch (PartInitException e) {
- ErrorDialog.openError(getContainer().getShell(), Messages.UMLCreationWizardOpenEditorError, null, e.getStatus());
- }
- }
- }
- };
- try {
- getContainer().run(false, true, op);
- } catch (InterruptedException e) {
- return false;
- } catch (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 diagram != null;
- }
-
- /**
- * @generated
- */
- public void setOpenNewlyCreatedDiagramEditor(boolean openNewlyCreatedDiagramEditor) {
- this.openNewlyCreatedDiagramEditor = openNewlyCreatedDiagramEditor;
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLCreationWizardPage.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLCreationWizardPage.java
deleted file mode 100644
index 44de45e5463..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLCreationWizardPage.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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
- */
-public class UMLCreationWizardPage extends WizardNewFileCreationPage {
-
- /**
- * @generated
- */
- private final String fileExtension;
-
- /**
- * @generated
- */
- public UMLCreationWizardPage(String pageName, IStructuredSelection selection, String fileExtension) {
- super(pageName, selection);
- this.fileExtension = fileExtension;
- }
-
- /**
- * @generated
- */
- public void createControl(Composite parent) {
- super.createControl(parent);
- setFileName(UMLDiagramEditorUtil.getUniqueFileName(getContainerFullPath(), getFileName(), getExtension()));
- setPageComplete(validatePage());
- }
-
- /**
- * Override to create files with this extension.
- *
- * @generated
- */
- protected String getExtension() {
- return fileExtension;
- }
-
- /**
- * @generated
- */
- protected IPath getFilePath() {
- IPath path = getContainerFullPath();
- if(path == null) {
- path = new Path(""); //$NON-NLS-1$
- }
- String fileName = getFileName();
- if(fileName != null) {
- path = path.append(fileName);
- }
- return path;
- }
-
- /**
- * @generated
- */
- public URI getURI() {
- return URI.createPlatformResourceURI(getFilePath().toString(), false);
- }
-
- /**
- * @generated
- */
- protected boolean validatePage() {
- if(!super.validatePage()) {
- return false;
- }
- 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/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDiagramActionBarContributor.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDiagramActionBarContributor.java
deleted file mode 100644
index bc2b509caa9..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDiagramActionBarContributor.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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
- */
-public class UMLDiagramActionBarContributor extends DiagramActionBarContributor {
-
- /**
- * @generated
- */
- protected Class getEditorClass() {
- return UMLDiagramEditor.class;
- }
-
- /**
- * @generated
- */
- protected String getEditorId() {
- return UMLDiagramEditor.ID;
- }
-
- /**
- * @generated
- */
- public void init(IActionBars bars, IWorkbenchPage page) {
- super.init(bars, page);
- // print preview
- IMenuManager fileMenu = bars.getMenuManager().findMenuUsingPath(IWorkbenchActionConstants.M_FILE);
- assert fileMenu != null;
- fileMenu.remove("pageSetupAction"); //$NON-NLS-1$
- 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$
- }
- IAction validateAction = new ValidateAction(page);
- editMenu.appendToGroup("validationGroup", validateAction); //$NON-NLS-1$
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDiagramEditor.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDiagramEditor.java
deleted file mode 100644
index e443ba5c0c3..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDiagramEditor.java
+++ /dev/null
@@ -1,521 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.part;
-
-import java.util.EventObject;
-
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.resources.IFile;
-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.emf.workspace.util.WorkspaceSynchronizer;
-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.core.adaptor.gmf.GmfMultiDiagramDocumentProvider;
-import org.eclipse.papyrus.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.core.services.ServiceException;
-import org.eclipse.papyrus.core.services.ServicesRegistry;
-import org.eclipse.papyrus.diagram.common.listeners.DropTargetListener;
-import org.eclipse.papyrus.diagram.common.part.PapyrusPaletteContextMenuProvider;
-import org.eclipse.papyrus.diagram.common.part.PapyrusPaletteViewer;
-import org.eclipse.papyrus.diagram.common.part.UmlGmfDiagramEditor;
-import org.eclipse.papyrus.diagram.common.service.PapyrusPaletteService;
-import org.eclipse.papyrus.diagram.statemachine.navigator.UMLNavigatorItem;
-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
- */
-public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderChangeListener, IGotoMarker {
-
- /**
- * @generated
- */
- public static final String ID = "org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorID"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final String CONTEXT_ID = "org.eclipse.papyrus.diagram.statemachine.ui.diagramContext"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private KeyHandler paletteKeyHandler = null;
-
- /**
- * @generated
- */
- private MouseListener paletteMouseListener = null;
-
- /**
- * @generated
- */
- private IUndoableOperation savedOperation = null;
-
- /**
- * @generated
- */
- private TransactionalEditingDomain editingDomain;
-
- /**
- * @generated
- */
- private IDocumentProvider documentProvider;
-
- /**
- * @generated
- */
- public UMLDiagramEditor(ServicesRegistry servicesRegistry, 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
- editingDomain = servicesRegistry.getService(TransactionalEditingDomain.class);
- documentProvider = new GmfMultiDiagramDocumentProvider(editingDomain);
-
- // overrides editing domain created by super constructor
- setDocumentProvider(documentProvider);
-
- }
-
- /**
- * @generated
- */
- protected void configureDiagramEditDomain() {
- super.configureDiagramEditDomain();
- getDiagramEditDomain().getDiagramCommandStack().addCommandStackListener(new CommandStackListener() {
-
- public void commandStackChanged(EventObject event) {
- firePropertyChange(IEditorPart.PROP_DIRTY);
- }
- });
- }
-
- /**
- * @generated
- */
- protected void configureGraphicalViewer() {
- super.configureGraphicalViewer();
- DiagramEditorContextMenuProvider provider = new DiagramEditorContextMenuProvider(this, getDiagramGraphicalViewer());
- getDiagramGraphicalViewer().setContextMenu(provider);
- getSite().registerContextMenu(ActionIds.DIAGRAM_EDITOR_CONTEXT_MENU, provider, getDiagramGraphicalViewer());
- }
-
- /**
- * @generated
- */
- protected PaletteViewer constructPaletteViewer() {
- return new PapyrusPaletteViewer();
- }
-
- /**
- * @generated
- */
- protected TransactionalEditingDomain createEditingDomain() {
- // Already configured
- return editingDomain;
- }
-
- /**
- * @generated
- */
- protected PaletteRoot createPaletteRoot(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
- */
- 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.
- */
- protected void configurePaletteViewer(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());
- }
-
- public PaletteViewer createPaletteViewer(Composite parent) {
- PaletteViewer pViewer = constructPaletteViewer();
- pViewer.createControl(parent);
- configurePaletteViewer(pViewer);
- hookPaletteViewer(pViewer);
- return pViewer;
- }
-
- /**
- * @return Palette Key Handler for the palette
- */
- private KeyHandler getPaletteKeyHandler() {
-
- if(paletteKeyHandler == null) {
-
- 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
- */
- public boolean keyReleased(KeyEvent event) {
-
- if(event.keyCode == SWT.Selection) {
-
- 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 paletteKeyHandler;
- }
-
- /**
- * @return Palette Mouse listener for the palette
- */
- private MouseListener getPaletteMouseListener() {
-
- if(paletteMouseListener == null) {
-
- 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(MouseEvent e) {
- 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.
- clearActiveTool = true;
- }
- }
-
- public void mouseDown(MouseEvent e) {
- // do nothing
- }
-
- public void mouseUp(MouseEvent e) {
- // Deactivate current active tool here if a
- // double-click was handled.
- if(clearActiveTool) {
- getPaletteViewer().setActiveTool(null);
- clearActiveTool = false;
- }
-
- }
- };
-
- }
- return paletteMouseListener;
- }
-
- };
- }
-
- /**
- * @generated
- */
- public void dispose() {
- // remove palette service listener
- // remove preference listener
- PapyrusPaletteService.getInstance().removeProviderChangeListener(this);
-
- super.dispose();
- }
-
- /**
- * @generated
- */
- public void doSave(IProgressMonitor progressMonitor) {
- // The saving of the resource is done by the CoreMultiDiagramEditor
- savedOperation = getOperationHistory().getUndoOperation(getUndoContext());
- }
-
- /**
- * @generated
- */
- public void doSaveAs() {
- performSaveAs(new NullProgressMonitor());
- }
-
- /**
- * @generated
- */
- public Object getAdapter(Class type) {
- if(type == IShowInTargetList.class) {
- return new IShowInTargetList() {
-
- public String[] getShowInTargetIds() {
- return new String[]{ ProjectExplorer.VIEW_ID };
- }
- };
- }
- return super.getAdapter(type);
- }
-
- /**
- * @generated
- */
- protected String getContextID() {
- return CONTEXT_ID;
- }
-
- /**
- * @generated
- */
- public String getContributorId() {
- return UMLDiagramEditorPlugin.ID;
- }
-
- /**
- * @generated
- */
- protected final IDocumentProvider getDocumentProvider(IEditorInput input) {
- return documentProvider;
- }
-
- /**
- * @generated
- */
- public TransactionalEditingDomain getEditingDomain() {
- return editingDomain;
- }
-
- /**
- * @generated
- */
- @Override
- public GraphicalViewer getGraphicalViewer() {
- return super.getGraphicalViewer();
- }
-
- /**
- * @generated
- */
- private ISelection getNavigatorSelection() {
- IDiagramDocument document = getDiagramDocument();
- if(document == null) {
- return StructuredSelection.EMPTY;
- }
- Diagram diagram = document.getDiagram();
- if(diagram == null || diagram.eResource() == null) {
- return StructuredSelection.EMPTY;
- }
- IFile file = WorkspaceSynchronizer.getFile(diagram.eResource());
- if(file != null) {
- UMLNavigatorItem item = new UMLNavigatorItem(diagram, file, false);
- return new StructuredSelection(item);
- }
- return StructuredSelection.EMPTY;
- }
-
- /**
- * @generated
- */
- protected PaletteViewer getPaletteViewer() {
- return getEditDomain().getPaletteViewer();
- }
-
- /**
- * @generated
- */
- protected PreferencesHint getPreferencesHint() {
- return UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
- }
-
- /**
- * @generated
- */
- public ShowInContext getShowInContext() {
- return new ShowInContext(getEditorInput(), getNavigatorSelection());
- }
-
- /**
- * @generated
- */
- public void gotoMarker(IMarker marker) {
- MarkerNavigationService.getInstance().gotoMarker(this, marker);
- }
-
- /**
- * @generated
- */
- @Override
- protected void initializeGraphicalViewer() {
- super.initializeGraphicalViewer();
-
- // Enable Drop
- getDiagramGraphicalViewer().addDropTargetListener(new DropTargetListener(getDiagramGraphicalViewer(), LocalSelectionTransfer.getTransfer()) {
-
- @Override
- protected Object getJavaObject(TransferData data) {
- return LocalSelectionTransfer.getTransfer().nativeToJava(data);
- }
-
- @Override
- protected TransactionalEditingDomain getTransactionalEditingDomain() {
- return getEditingDomain();
- }
- });
-
- }
-
- /**
- * @generated
- */
- public boolean isDirty() {
- IUndoableOperation op = getOperationHistory().getUndoOperation(getUndoContext());
- return savedOperation != op;
- }
-
- /**
- * @generated
- */
- public boolean isSaveAsAllowed() {
- return true;
- }
-
- /**
- * @generated
- */
- protected void performSaveAs(IProgressMonitor progressMonitor) {
- // Nothing
- }
-
- /**
- * @generated
- */
- public void providerChanged(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 selectionChanged(IWorkbenchPart part, ISelection selection) {
- if(getSite().getPage().getActiveEditor() instanceof IMultiDiagramEditor) {
- IMultiDiagramEditor editor = (IMultiDiagramEditor)getSite().getPage().getActiveEditor();
- // If not the active editor, ignore selection changed.
- if(this.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();
- }
- }
-
- /**
- * @generated
- */
- protected final void setDocumentProvider(IEditorInput input) {
- // Already set in the constructor
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDiagramEditorPlugin.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDiagramEditorPlugin.java
deleted file mode 100644
index a58b3916fd6..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDiagramEditorPlugin.java
+++ /dev/null
@@ -1,301 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.diagram.statemachine.edit.policies.UMLBaseItemSemanticEditPolicy;
-import org.eclipse.papyrus.diagram.statemachine.preferences.DiagramPreferenceInitializer;
-import org.eclipse.papyrus.diagram.statemachine.providers.ElementInitializers;
-import org.eclipse.papyrus.preferences.Activator;
-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
- */
-public class UMLDiagramEditorPlugin extends AbstractUIPlugin {
-
- /**
- * @generated
- */
- public static final String ID = "org.eclipse.papyrus.diagram.statemachine"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final PreferencesHint DIAGRAM_PREFERENCES_HINT = new PreferencesHint(ID);
-
- /**
- * @generated
- */
- private static UMLDiagramEditorPlugin instance;
-
- /**
- * 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(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 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(String path) {
- return AbstractUIPlugin.imageDescriptorFromPlugin(ID, path);
- }
-
- /**
- * @generated
- */
- public static UMLDiagramEditorPlugin getInstance() {
- return instance;
- }
-
- /**
- * Returns string from plug-in's resource bundle
- *
- * @generated
- */
- public static String getString(String key) {
- return Platform.getResourceString(getInstance().getBundle(), "%" + key); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- private ComposedAdapterFactory adapterFactory;
-
- /**
- * @generated
- */
- private UMLDocumentProvider documentProvider;
-
- /**
- * @generated
- */
- private UMLBaseItemSemanticEditPolicy.LinkConstraints linkConstraints;
-
- /**
- * @generated
- */
- private ElementInitializers initializers;
-
- /**
- * @generated
- */
- public UMLDiagramEditorPlugin() {
- }
-
- /**
- * @generated
- */
- protected ComposedAdapterFactory createAdapterFactory() {
- ArrayList<AdapterFactory> factories = new ArrayList<AdapterFactory>();
- fillItemProviderFactories(factories);
- return new ComposedAdapterFactory(factories);
- }
-
- /**
- * @generated
- */
- private void debug(String message, Throwable throwable) {
- if(!isDebugging()) {
- return;
- }
- if(message != null) {
- System.err.println(message);
- }
- if(throwable != null) {
- throwable.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- protected void fillItemProviderFactories(List<AdapterFactory> factories) {
- factories.add(new UMLItemProviderAdapterFactory());
- factories.add(new EcoreItemProviderAdapterFactory());
- factories.add(new ResourceItemProviderAdapterFactory());
- factories.add(new ReflectiveItemProviderAdapterFactory());
- }
-
- /**
- * 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(String path) {
- Image image = getImageRegistry().get(path);
- if(image == null) {
- getImageRegistry().put(path, getBundledImageDescriptor(path));
- image = getImageRegistry().get(path);
- }
- return image;
- }
-
- /**
- * @generated
- */
- public UMLDocumentProvider getDocumentProvider() {
- if(documentProvider == null) {
- documentProvider = new UMLDocumentProvider();
- }
- return documentProvider;
- }
-
- /**
- * @generated
- */
- public ElementInitializers getElementInitializers() {
- return initializers;
- }
-
- /**
- * @generated
- */
- public ImageDescriptor getItemImageDescriptor(Object item) {
- IItemLabelProvider labelProvider = (IItemLabelProvider)adapterFactory.adapt(item, IItemLabelProvider.class);
- if(labelProvider != null) {
- return ExtendedImageRegistry.getInstance().getImageDescriptor(labelProvider.getImage(item));
- }
- return null;
- }
-
- /**
- * @generated
- */
- public AdapterFactory getItemProvidersAdapterFactory() {
- return adapterFactory;
- }
-
- /**
- * @generated
- */
- public UMLBaseItemSemanticEditPolicy.LinkConstraints getLinkConstraints() {
- return linkConstraints;
- }
-
- /**
- * @generated
- */
- public IPreferenceStore getPreferenceStore() {
- IPreferenceStore store = Activator.getDefault().getPreferenceStore();
- return store;
- }
-
- /**
- * @generated
- */
- public void logError(String error) {
- logError(error, null);
- }
-
- /**
- * @generated
- */
- public void logError(String error, 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(String message) {
- logInfo(message, null);
- }
-
- /**
- * @generated
- */
- public void logInfo(String message, 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
- */
- public void setElementInitializers(ElementInitializers i) {
- this.initializers = i;
- }
-
- /**
- * @generated
- */
- public void setLinkConstraints(UMLBaseItemSemanticEditPolicy.LinkConstraints lc) {
- this.linkConstraints = lc;
- }
-
- /**
- * @generated
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- instance = this;
- PreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT, getPreferenceStore());
- adapterFactory = createAdapterFactory();
- DiagramPreferenceInitializer diagramPreferenceInitializer = new DiagramPreferenceInitializer();
- diagramPreferenceInitializer.initializeDefaultPreferences();
- }
-
- /**
- * @generated
- */
- public void stop(BundleContext context) throws Exception {
- adapterFactory.dispose();
- adapterFactory = null;
- linkConstraints = null;
- initializers = null;
- instance = null;
- super.stop(context);
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDiagramEditorUtil.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDiagramEditorUtil.java
deleted file mode 100644
index c505725108a..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDiagramEditorUtil.java
+++ /dev/null
@@ -1,366 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.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.GMFEditingDomainFactory;
-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.diagram.statemachine.edit.parts.PackageEditPart;
-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
- */
-public class UMLDiagramEditorUtil {
-
- /**
- * @generated
- */
- public static class LazyElement2ViewMap {
-
- /**
- * @generated
- */
- private static boolean buildElement2ViewMap(View parentView, Map<EObject, View> element2ViewMap, 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(Iterator<?> it = parentView.getChildren().iterator(); it.hasNext() && !complete;) {
- complete = buildElement2ViewMap((View)it.next(), element2ViewMap, elements);
- }
- for(Iterator<?> it = parentView.getSourceEdges().iterator(); it.hasNext() && !complete;) {
- complete = buildElement2ViewMap((View)it.next(), element2ViewMap, elements);
- }
- for(Iterator<?> it = parentView.getTargetEdges().iterator(); it.hasNext() && !complete;) {
- complete = buildElement2ViewMap((View)it.next(), element2ViewMap, elements);
- }
- return complete;
- }
-
- /**
- * @generated
- */
- private Map<EObject, View> element2ViewMap;
-
- /**
- * @generated
- */
- private View scope;
-
- /**
- * @generated
- */
- private Set<? extends EObject> elementSet;
-
- /**
- * @generated
- */
- public LazyElement2ViewMap(View scope, Set<? extends EObject> elements) {
- this.scope = scope;
- this.elementSet = elements;
- }
-
- /**
- * @generated
- */
- public final Map<EObject, View> getElement2ViewMap() {
- if(element2ViewMap == null) {
- element2ViewMap = new HashMap<EObject, View>();
- // map possible notation elements to itself as these can't be found by view.getElement()
- for(EObject element : elementSet) {
- if(element instanceof View) {
- View view = (View)element;
- if(view.getDiagram() == scope.getDiagram()) {
- element2ViewMap.put(element, view); // take only those that part of our diagram
- }
- }
- }
-
- buildElement2ViewMap(scope, element2ViewMap, elementSet);
- }
- return element2ViewMap;
- }
- } // LazyElement2ViewMap
-
- /**
- * Store model element in the resource.
- * <!-- begin-user-doc --> <!--
- * end-user-doc -->
- *
- * @generated
- */
- private static void attachModelToResource(Package model, Resource resource) {
- resource.getContents().add(model);
- }
-
- /**
- * This method should be called within a workspace modify operation since it
- * creates resources.
- *
- * @generated
- */
- public static Resource createDiagram(URI diagramURI, URI modelURI, IProgressMonitor progressMonitor) {
- TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.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();
- AbstractTransactionalCommand command = new AbstractTransactionalCommand(editingDomain, Messages.UMLDiagramEditorUtil_CreateDiagramCommandLabel, Collections.EMPTY_LIST) {
-
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- Package model = createInitialModel();
- attachModelToResource(model, modelResource);
-
- Diagram diagram = ViewService.createDiagram(model, PackageEditPart.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.diagram.statemachine.part.UMLDiagramEditorUtil.getSaveOptions());
- diagramResource.save(org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorUtil.getSaveOptions());
- } catch (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 (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();
- }
-
- /**
- * @generated
- */
- private static int findElementsInDiagramByID(DiagramEditPart diagramPart, EObject element, List<EditPart> editPartCollector) {
- IDiagramGraphicalViewer viewer = (IDiagramGraphicalViewer)diagramPart.getViewer();
- final int intialNumOfEditParts = editPartCollector.size();
-
- if(element instanceof View) { // support notation element lookup
- EditPart editPart = (EditPart)viewer.getEditPartRegistry().get(element);
- if(editPart != null) {
- editPartCollector.add(editPart);
- return 1;
- }
- }
-
- String elementID = EMFCoreUtil.getProxyID(element);
- @SuppressWarnings("unchecked")
- List<EditPart> associatedParts = viewer.findEditPartsForElement(elementID, IGraphicalEditPart.class);
- // perform the possible hierarchy disjoint -> take the top-most parts only
- for(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(DiagramEditPart diagramEditPart, EObject targetElement, LazyElement2ViewMap lazyElement2ViewMap) {
- boolean hasStructuralURI = false;
- if(targetElement.eResource() instanceof XMLResource) {
- hasStructuralURI = ((XMLResource)targetElement.eResource()).getID(targetElement) == null;
- }
-
- View view = null;
- LinkedList<EditPart> editPartHolder = new LinkedList<EditPart>();
- if(hasStructuralURI && !lazyElement2ViewMap.getElement2ViewMap().isEmpty()) {
- view = lazyElement2ViewMap.getElement2ViewMap().get(targetElement);
- } else if(findElementsInDiagramByID(diagramEditPart, targetElement, editPartHolder) > 0) {
- EditPart editPart = editPartHolder.get(0);
- view = editPart.getModel() instanceof View ? (View)editPart.getModel() : null;
- }
-
- return (view == null) ? diagramEditPart.getDiagramView() : view;
- }
-
- /**
- * @generated
- */
- public static Map<?, ?> getSaveOptions() {
- 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 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();
- }
-
- /**
- * @generated
- */
- public static boolean openDiagram(Resource diagram) throws PartInitException {
- String path = diagram.getURI().toPlatformString(true);
- IResource workspaceResource = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(path));
- if(workspaceResource instanceof IFile) {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- return null != page.openEditor(new FileEditorInput((IFile)workspaceResource), UMLDiagramEditor.ID);
- }
- return false;
- }
-
- /**
- * Runs the wizard in a dialog.
- *
- * @generated
- */
- public static void runWizard(Shell shell, Wizard wizard, String settingsKey) {
- IDialogSettings pluginDialogSettings = UMLDiagramEditorPlugin.getInstance().getDialogSettings();
- IDialogSettings wizardDialogSettings = pluginDialogSettings.getSection(settingsKey);
- if(wizardDialogSettings == null) {
- wizardDialogSettings = pluginDialogSettings.addNewSection(settingsKey);
- }
- wizard.setDialogSettings(wizardDialogSettings);
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.create();
- dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), 500);
- dialog.open();
- }
-
- /**
- * @generated
- */
- public static void selectElementsInDiagram(IDiagramWorkbenchPart diagramPart, List<EditPart> editParts) {
- diagramPart.getDiagramGraphicalViewer().deselectAll();
-
- EditPart firstPrimary = null;
- for(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
- */
- public static void setCharset(IFile file) {
- if(file == null) {
- return;
- }
- try {
- file.setCharset("UTF-8", new NullProgressMonitor()); //$NON-NLS-1$
- } catch (CoreException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Unable to set charset for file " + file.getFullPath(), e); //$NON-NLS-1$
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDiagramUpdateCommand.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDiagramUpdateCommand.java
deleted file mode 100644
index 41f1162e84d..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDiagramUpdateCommand.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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
- */
-public class UMLDiagramUpdateCommand implements IHandler {
-
- /**
- * @generated
- */
- public void addHandlerListener(IHandlerListener handlerListener) {
- }
-
- /**
- * @generated
- */
- public void dispose() {
- }
-
- /**
- * @generated
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
- if(selection instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection)selection;
- if(structuredSelection.size() != 1) {
- return null;
- }
- if(structuredSelection.getFirstElement() instanceof EditPart && ((EditPart)structuredSelection.getFirstElement()).getModel() instanceof View) {
- EObject modelElement = ((View)((EditPart)structuredSelection.getFirstElement()).getModel()).getElement();
- List editPolicies = CanonicalEditPolicy.getRegisteredEditPolicies(modelElement);
- for(Iterator it = editPolicies.iterator(); it.hasNext();) {
- 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(IHandlerListener handlerListener) {
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDiagramUpdater.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDiagramUpdater.java
deleted file mode 100644
index e6d71997f77..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDiagramUpdater.java
+++ /dev/null
@@ -1,964 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.part;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-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.papyrus.diagram.common.part.ICustomDiagramUpdater;
-import org.eclipse.papyrus.diagram.statemachine.custom.parts.RegionCompartmentDiagramUpdater;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.ConnectionPointReferenceEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.FinalStateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateChoiceEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateDeepHistoryEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateForkEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateInitialEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJoinEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJunctionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateShallowHistoryEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateTerminateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.uml2.uml.Classifier;
-import org.eclipse.uml2.uml.ConnectionPointReference;
-import org.eclipse.uml2.uml.FinalState;
-import org.eclipse.uml2.uml.Generalization;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.PackageableElement;
-import org.eclipse.uml2.uml.Pseudostate;
-import org.eclipse.uml2.uml.Region;
-import org.eclipse.uml2.uml.State;
-import org.eclipse.uml2.uml.StateMachine;
-import org.eclipse.uml2.uml.Transition;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.Vertex;
-
-/**
- * @generated
- */
-public class UMLDiagramUpdater {
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getConnectionPointReference_18000ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getConnectionPointReference_18000IncomingLinks(View view) {
- ConnectionPointReference modelElement = (ConnectionPointReference)view.getElement();
- Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Transition_7000(modelElement, crossReferences));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getConnectionPointReference_18000OutgoingLinks(View view) {
- ConnectionPointReference modelElement = (ConnectionPointReference)view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Transition_7000(modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getContainedLinks(View view) {
- switch(UMLVisualIDRegistry.getVisualID(view)) {
- case PackageEditPart.VISUAL_ID:
- return getPackage_1000ContainedLinks(view);
- case StateMachineEditPart.VISUAL_ID:
- return getStateMachine_2000ContainedLinks(view);
- case RegionEditPart.VISUAL_ID:
- return getRegion_3000ContainedLinks(view);
- case FinalStateEditPart.VISUAL_ID:
- return getFinalState_5000ContainedLinks(view);
- case StateEditPart.VISUAL_ID:
- return getState_6000ContainedLinks(view);
- case PseudostateInitialEditPart.VISUAL_ID:
- return getPseudostate_8000ContainedLinks(view);
- case PseudostateJoinEditPart.VISUAL_ID:
- return getPseudostate_9000ContainedLinks(view);
- case PseudostateForkEditPart.VISUAL_ID:
- return getPseudostate_10000ContainedLinks(view);
- case PseudostateChoiceEditPart.VISUAL_ID:
- return getPseudostate_11000ContainedLinks(view);
- case PseudostateJunctionEditPart.VISUAL_ID:
- return getPseudostate_12000ContainedLinks(view);
- case PseudostateShallowHistoryEditPart.VISUAL_ID:
- return getPseudostate_13000ContainedLinks(view);
- case PseudostateDeepHistoryEditPart.VISUAL_ID:
- return getPseudostate_14000ContainedLinks(view);
- case PseudostateTerminateEditPart.VISUAL_ID:
- return getPseudostate_15000ContainedLinks(view);
- case PseudostateEntryPointEditPart.VISUAL_ID:
- return getPseudostate_16000ContainedLinks(view);
- case PseudostateExitPointEditPart.VISUAL_ID:
- return getPseudostate_17000ContainedLinks(view);
- case ConnectionPointReferenceEditPart.VISUAL_ID:
- return getConnectionPointReference_18000ContainedLinks(view);
- case TransitionEditPart.VISUAL_ID:
- return getTransition_7000ContainedLinks(view);
- case GeneralizationEditPart.VISUAL_ID:
- return getGeneralization_19000ContainedLinks(view);
- }
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- private static Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Generalization_19000(Classifier container) {
- Collection result = new LinkedList();
- for(Iterator links = container.getGeneralizations().iterator(); links.hasNext();) {
- EObject linkObject = (EObject)links.next();
- if(false == linkObject instanceof Generalization) {
- continue;
- }
- Generalization link = (Generalization)linkObject;
- if(GeneralizationEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
- continue;
- }
-
- Classifier dst = link.getGeneral();
- result.add(new UMLLinkDescriptor(container, dst, link, UMLElementTypes.Generalization_19000, GeneralizationEditPart.VISUAL_ID));
-
- }
- return result;
- }
-
- /**
- * @generated
- */
- private static Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Transition_7000(Region container) {
- Collection result = new LinkedList();
- for(Iterator links = container.getTransitions().iterator(); links.hasNext();) {
- EObject linkObject = (EObject)links.next();
- if(false == linkObject instanceof Transition) {
- continue;
- }
- Transition link = (Transition)linkObject;
- if(TransitionEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
- continue;
- }
-
- Vertex dst = link.getTarget();
- Vertex src = link.getSource();
- result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Transition_7000, TransitionEditPart.VISUAL_ID));
-
- }
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getFinalState_5000ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getFinalState_5000IncomingLinks(View view) {
- FinalState modelElement = (FinalState)view.getElement();
- Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Transition_7000(modelElement, crossReferences));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getFinalState_5000OutgoingLinks(View view) {
- FinalState modelElement = (FinalState)view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Transition_7000(modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getGeneralization_19000ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getGeneralization_19000IncomingLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getGeneralization_19000OutgoingLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getIncomingLinks(View view) {
- switch(UMLVisualIDRegistry.getVisualID(view)) {
- case StateMachineEditPart.VISUAL_ID:
- return getStateMachine_2000IncomingLinks(view);
- case RegionEditPart.VISUAL_ID:
- return getRegion_3000IncomingLinks(view);
- case FinalStateEditPart.VISUAL_ID:
- return getFinalState_5000IncomingLinks(view);
- case StateEditPart.VISUAL_ID:
- return getState_6000IncomingLinks(view);
- case PseudostateInitialEditPart.VISUAL_ID:
- return getPseudostate_8000IncomingLinks(view);
- case PseudostateJoinEditPart.VISUAL_ID:
- return getPseudostate_9000IncomingLinks(view);
- case PseudostateForkEditPart.VISUAL_ID:
- return getPseudostate_10000IncomingLinks(view);
- case PseudostateChoiceEditPart.VISUAL_ID:
- return getPseudostate_11000IncomingLinks(view);
- case PseudostateJunctionEditPart.VISUAL_ID:
- return getPseudostate_12000IncomingLinks(view);
- case PseudostateShallowHistoryEditPart.VISUAL_ID:
- return getPseudostate_13000IncomingLinks(view);
- case PseudostateDeepHistoryEditPart.VISUAL_ID:
- return getPseudostate_14000IncomingLinks(view);
- case PseudostateTerminateEditPart.VISUAL_ID:
- return getPseudostate_15000IncomingLinks(view);
- case PseudostateEntryPointEditPart.VISUAL_ID:
- return getPseudostate_16000IncomingLinks(view);
- case PseudostateExitPointEditPart.VISUAL_ID:
- return getPseudostate_17000IncomingLinks(view);
- case ConnectionPointReferenceEditPart.VISUAL_ID:
- return getConnectionPointReference_18000IncomingLinks(view);
- case TransitionEditPart.VISUAL_ID:
- return getTransition_7000IncomingLinks(view);
- case GeneralizationEditPart.VISUAL_ID:
- return getGeneralization_19000IncomingLinks(view);
- }
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- private static Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Generalization_19000(Classifier target, Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences) {
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- Collection<EStructuralFeature.Setting> settings = crossReferences.get(target);
- for(EStructuralFeature.Setting setting : settings) {
- if(setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getGeneralization_General() || false == setting.getEObject() instanceof Generalization) {
- continue;
- }
- Generalization link = (Generalization)setting.getEObject();
- if(GeneralizationEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
- continue;
- }
- if(false == link.eContainer() instanceof Classifier) {
- continue;
- }
- Classifier container = (Classifier)link.eContainer();
- result.add(new UMLLinkDescriptor(container, target, link, UMLElementTypes.Generalization_19000, GeneralizationEditPart.VISUAL_ID));
-
- }
- return result;
- }
-
- /**
- * @generated
- */
- private static Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Transition_7000(Vertex target, Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences) {
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- Collection<EStructuralFeature.Setting> settings = crossReferences.get(target);
- for(EStructuralFeature.Setting setting : settings) {
- if(setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getTransition_Target() || false == setting.getEObject() instanceof Transition) {
- continue;
- }
- Transition link = (Transition)setting.getEObject();
- if(TransitionEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
- continue;
- }
- Vertex src = link.getSource();
- result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Transition_7000, TransitionEditPart.VISUAL_ID));
- }
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getOutgoingLinks(View view) {
- switch(UMLVisualIDRegistry.getVisualID(view)) {
- case StateMachineEditPart.VISUAL_ID:
- return getStateMachine_2000OutgoingLinks(view);
- case RegionEditPart.VISUAL_ID:
- return getRegion_3000OutgoingLinks(view);
- case FinalStateEditPart.VISUAL_ID:
- return getFinalState_5000OutgoingLinks(view);
- case StateEditPart.VISUAL_ID:
- return getState_6000OutgoingLinks(view);
- case PseudostateInitialEditPart.VISUAL_ID:
- return getPseudostate_8000OutgoingLinks(view);
- case PseudostateJoinEditPart.VISUAL_ID:
- return getPseudostate_9000OutgoingLinks(view);
- case PseudostateForkEditPart.VISUAL_ID:
- return getPseudostate_10000OutgoingLinks(view);
- case PseudostateChoiceEditPart.VISUAL_ID:
- return getPseudostate_11000OutgoingLinks(view);
- case PseudostateJunctionEditPart.VISUAL_ID:
- return getPseudostate_12000OutgoingLinks(view);
- case PseudostateShallowHistoryEditPart.VISUAL_ID:
- return getPseudostate_13000OutgoingLinks(view);
- case PseudostateDeepHistoryEditPart.VISUAL_ID:
- return getPseudostate_14000OutgoingLinks(view);
- case PseudostateTerminateEditPart.VISUAL_ID:
- return getPseudostate_15000OutgoingLinks(view);
- case PseudostateEntryPointEditPart.VISUAL_ID:
- return getPseudostate_16000OutgoingLinks(view);
- case PseudostateExitPointEditPart.VISUAL_ID:
- return getPseudostate_17000OutgoingLinks(view);
- case ConnectionPointReferenceEditPart.VISUAL_ID:
- return getConnectionPointReference_18000OutgoingLinks(view);
- case TransitionEditPart.VISUAL_ID:
- return getTransition_7000OutgoingLinks(view);
- case GeneralizationEditPart.VISUAL_ID:
- return getGeneralization_19000OutgoingLinks(view);
- }
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- private static Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Transition_7000(Vertex source) {
- Region 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 Region) {
- container = (Region)element;
- }
- }
- if(container == null) {
- return Collections.emptyList();
- }
- Collection result = new LinkedList();
- for(Iterator links = container.getTransitions().iterator(); links.hasNext();) {
- EObject linkObject = (EObject)links.next();
- if(false == linkObject instanceof Transition) {
- continue;
- }
- Transition link = (Transition)linkObject;
- if(TransitionEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
- continue;
- }
-
- Vertex dst = link.getTarget();
- Vertex src = link.getSource();
- if(src != source) {
- continue;
- }
- result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Transition_7000, TransitionEditPart.VISUAL_ID));
-
- }
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPackage_1000ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLNodeDescriptor> getPackage_1000SemanticChildren(View view) {
- if(!view.isSetElement()) {
- return Collections.EMPTY_LIST;
- }
- Package modelElement = (Package)view.getElement();
- LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for(Iterator<?> it = modelElement.getPackagedElements().iterator(); it.hasNext();) {
- PackageableElement childElement = (PackageableElement)it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if(visualID == StateMachineEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_10000ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_10000IncomingLinks(View view) {
- Pseudostate modelElement = (Pseudostate)view.getElement();
- Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Transition_7000(modelElement, crossReferences));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_10000OutgoingLinks(View view) {
- Pseudostate modelElement = (Pseudostate)view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Transition_7000(modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_11000ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_11000IncomingLinks(View view) {
- Pseudostate modelElement = (Pseudostate)view.getElement();
- Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Transition_7000(modelElement, crossReferences));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_11000OutgoingLinks(View view) {
- Pseudostate modelElement = (Pseudostate)view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Transition_7000(modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_12000ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_12000IncomingLinks(View view) {
- Pseudostate modelElement = (Pseudostate)view.getElement();
- Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Transition_7000(modelElement, crossReferences));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_12000OutgoingLinks(View view) {
- Pseudostate modelElement = (Pseudostate)view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Transition_7000(modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_13000ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_13000IncomingLinks(View view) {
- Pseudostate modelElement = (Pseudostate)view.getElement();
- Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Transition_7000(modelElement, crossReferences));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_13000OutgoingLinks(View view) {
- Pseudostate modelElement = (Pseudostate)view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Transition_7000(modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_14000ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_14000IncomingLinks(View view) {
- Pseudostate modelElement = (Pseudostate)view.getElement();
- Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Transition_7000(modelElement, crossReferences));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_14000OutgoingLinks(View view) {
- Pseudostate modelElement = (Pseudostate)view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Transition_7000(modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_15000ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_15000IncomingLinks(View view) {
- Pseudostate modelElement = (Pseudostate)view.getElement();
- Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Transition_7000(modelElement, crossReferences));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_15000OutgoingLinks(View view) {
- Pseudostate modelElement = (Pseudostate)view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Transition_7000(modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_16000ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_16000IncomingLinks(View view) {
- Pseudostate modelElement = (Pseudostate)view.getElement();
- Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Transition_7000(modelElement, crossReferences));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_16000OutgoingLinks(View view) {
- Pseudostate modelElement = (Pseudostate)view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Transition_7000(modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_17000ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_17000IncomingLinks(View view) {
- Pseudostate modelElement = (Pseudostate)view.getElement();
- Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Transition_7000(modelElement, crossReferences));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_17000OutgoingLinks(View view) {
- Pseudostate modelElement = (Pseudostate)view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Transition_7000(modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_8000ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_8000IncomingLinks(View view) {
- Pseudostate modelElement = (Pseudostate)view.getElement();
- Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Transition_7000(modelElement, crossReferences));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_8000OutgoingLinks(View view) {
- Pseudostate modelElement = (Pseudostate)view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Transition_7000(modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_9000ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_9000IncomingLinks(View view) {
- Pseudostate modelElement = (Pseudostate)view.getElement();
- Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Transition_7000(modelElement, crossReferences));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getPseudostate_9000OutgoingLinks(View view) {
- Pseudostate modelElement = (Pseudostate)view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Transition_7000(modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getRegion_3000ContainedLinks(View view) {
- Region modelElement = (Region)view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Transition_7000(modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getRegion_3000IncomingLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getRegion_3000OutgoingLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List getRegionRegionCompartment_3002SemanticChildren(View view) {
- ICustomDiagramUpdater customUpdater = new RegionCompartmentDiagramUpdater();
- return customUpdater.getSemanticChildren(view);
- }
-
- /**
- * @generated
- */
- public static List<UMLNodeDescriptor> getSemanticChildren(View view) {
- switch(UMLVisualIDRegistry.getVisualID(view)) {
- case PackageEditPart.VISUAL_ID:
- return getPackage_1000SemanticChildren(view);
- case StateMachineEditPart.VISUAL_ID:
- return getStateMachine_2000SemanticChildren(view);
- case StateEditPart.VISUAL_ID:
- return getState_6000SemanticChildren(view);
- case RegionCompartmentEditPart.VISUAL_ID:
- return getRegionRegionCompartment_3002SemanticChildren(view);
- case StateMachineCompartmentEditPart.VISUAL_ID:
- return getStateMachineStateMachineCompartment_2002SemanticChildren(view);
- case StateCompartmentEditPart.VISUAL_ID:
- return getStateStateCompartment_6002SemanticChildren(view);
- }
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getState_6000ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getState_6000IncomingLinks(View view) {
- State modelElement = (State)view.getElement();
- Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Transition_7000(modelElement, crossReferences));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getState_6000OutgoingLinks(View view) {
- State modelElement = (State)view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Transition_7000(modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLNodeDescriptor> getState_6000SemanticChildren(View view) {
- if(!view.isSetElement()) {
- return Collections.EMPTY_LIST;
- }
- State modelElement = (State)view.getElement();
- LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for(Iterator<?> it = modelElement.getRegions().iterator(); it.hasNext();) {
- Region childElement = (Region)it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if(visualID == RegionEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- for(Iterator<?> it = modelElement.getConnectionPoints().iterator(); it.hasNext();) {
- Pseudostate childElement = (Pseudostate)it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if(visualID == PseudostateEntryPointEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if(visualID == PseudostateExitPointEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- for(Iterator<?> it = modelElement.getConnections().iterator(); it.hasNext();) {
- ConnectionPointReference childElement = (ConnectionPointReference)it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if(visualID == ConnectionPointReferenceEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getStateMachine_2000ContainedLinks(View view) {
- StateMachine modelElement = (StateMachine)view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Generalization_19000(modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getStateMachine_2000IncomingLinks(View view) {
- StateMachine modelElement = (StateMachine)view.getElement();
- Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Generalization_19000(modelElement, crossReferences));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getStateMachine_2000OutgoingLinks(View view) {
- StateMachine modelElement = (StateMachine)view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Generalization_19000(modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLNodeDescriptor> getStateMachine_2000SemanticChildren(View view) {
- if(!view.isSetElement()) {
- return Collections.EMPTY_LIST;
- }
- StateMachine modelElement = (StateMachine)view.getElement();
- LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for(Iterator<?> it = modelElement.getConnectionPoints().iterator(); it.hasNext();) {
- Pseudostate childElement = (Pseudostate)it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if(visualID == PseudostateEntryPointEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if(visualID == PseudostateExitPointEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLNodeDescriptor> getStateMachineStateMachineCompartment_2002SemanticChildren(View view) {
- if(false == view.eContainer() instanceof View) {
- return Collections.emptyList();
- }
- View containerView = (View)view.eContainer();
- if(!containerView.isSetElement()) {
- return Collections.emptyList();
- }
- StateMachine modelElement = (StateMachine)containerView.getElement();
- LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for(Iterator<?> it = modelElement.getRegions().iterator(); it.hasNext();) {
- Region childElement = (Region)it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if(visualID == RegionEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- for(Iterator<?> it = modelElement.getConnectionPoints().iterator(); it.hasNext();) {
- Pseudostate childElement = (Pseudostate)it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if(visualID == PseudostateEntryPointEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if(visualID == PseudostateExitPointEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLNodeDescriptor> getStateStateCompartment_6002SemanticChildren(View view) {
- if(false == view.eContainer() instanceof View) {
- return Collections.emptyList();
- }
- View containerView = (View)view.eContainer();
- if(!containerView.isSetElement()) {
- return Collections.emptyList();
- }
- State modelElement = (State)containerView.getElement();
- LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for(Iterator<?> it = modelElement.getRegions().iterator(); it.hasNext();) {
- Region childElement = (Region)it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if(visualID == RegionEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- for(Iterator<?> it = modelElement.getConnections().iterator(); it.hasNext();) {
- ConnectionPointReference childElement = (ConnectionPointReference)it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if(visualID == ConnectionPointReferenceEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getTransition_7000ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getTransition_7000IncomingLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public static List<UMLLinkDescriptor> getTransition_7000OutgoingLinks(View view) {
- return Collections.emptyList();
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDocumentProvider.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDocumentProvider.java
deleted file mode 100644
index f42f5379103..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLDocumentProvider.java
+++ /dev/null
@@ -1,976 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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
- */
-public class UMLDocumentProvider extends AbstractDocumentProvider implements IDiagramDocumentProvider {
-
- /**
- * @generated
- */
- protected class ResourceSetInfo extends ElementInfo {
-
- /**
- * @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) {
- ResourceSetInfo.this.setUnSynchronized(resource);
- return true;
- }
- }
- Display.getDefault().asyncExec(new Runnable() {
-
- public void run() {
- handleElementChanged(ResourceSetInfo.this, resource, null);
- }
- });
- return true;
- }
-
- /**
- * @generated
- */
- public boolean handleResourceDeleted(Resource resource) {
- synchronized(ResourceSetInfo.this) {
- if(ResourceSetInfo.this.fCanBeSaved) {
- ResourceSetInfo.this.setUnSynchronized(resource);
- return true;
- }
- }
- Display.getDefault().asyncExec(new Runnable() {
-
- public void run() {
- fireElementDeleted(ResourceSetInfo.this.getEditorInput());
- }
- });
- return true;
- }
-
- /**
- * @generated
- */
- public boolean handleResourceMoved(Resource resource, final URI newURI) {
- synchronized(ResourceSetInfo.this) {
- if(ResourceSetInfo.this.fCanBeSaved) {
- ResourceSetInfo.this.setUnSynchronized(resource);
- return true;
- }
- }
- if(myDocument.getDiagram().eResource() == resource) {
- Display.getDefault().asyncExec(new Runnable() {
-
- public void run() {
- handleElementMoved(ResourceSetInfo.this.getEditorInput(), newURI);
- }
- });
- } else {
- handleResourceDeleted(resource);
- }
- return true;
- }
-
- }
-
- /**
- * @generated
- */
- private long myModificationStamp = IResource.NULL_STAMP;
-
- /**
- * @generated
- */
- private WorkspaceSynchronizer mySynchronizer;
-
- /**
- * @generated
- */
- private LinkedList<Resource> myUnSynchronizedResources = new LinkedList<Resource>();
-
- /**
- * @generated
- */
- private IDiagramDocument myDocument;
-
- /**
- * @generated
- */
- private IEditorInput myEditorInput;
-
- /**
- * @generated
- */
- private boolean myUpdateCache = true;
-
- /**
- * @generated
- */
- private boolean myModifiable = false;
-
- /**
- * @generated
- */
- private boolean myReadOnly = true;
-
- /**
- * @generated
- */
- private ResourceSetModificationListener myResourceSetListener;
-
- /**
- * @generated
- */
- public ResourceSetInfo(IDiagramDocument document, IEditorInput editorInput) {
- super(document);
- myDocument = document;
- myEditorInput = editorInput;
- startResourceListening();
- myResourceSetListener = new ResourceSetModificationListener(this);
- getResourceSet().eAdapters().add(myResourceSetListener);
- }
-
- /**
- * @generated
- */
- public void dispose() {
- stopResourceListening();
- getResourceSet().eAdapters().remove(myResourceSetListener);
- for(Iterator<Resource> it = getLoadedResourcesIterator(); it.hasNext();) {
- Resource resource = it.next();
- resource.unload();
- }
- getEditingDomain().dispose();
- }
-
- /**
- * @generated
- */
- public TransactionalEditingDomain getEditingDomain() {
- return myDocument.getEditingDomain();
- }
-
- /**
- * @generated
- */
- public IEditorInput getEditorInput() {
- return myEditorInput;
- }
-
- /**
- * @generated
- */
- public Iterator<Resource> getLoadedResourcesIterator() {
- return new ArrayList<Resource>(getResourceSet().getResources()).iterator();
- }
-
- /**
- * @generated
- */
- public long getModificationStamp() {
- return myModificationStamp;
- }
-
- /**
- * @generated
- */
- public ResourceSet getResourceSet() {
- return getEditingDomain().getResourceSet();
- }
-
- /**
- * @generated
- */
- public boolean isModifiable() {
- return myModifiable;
- }
-
- /**
- * @generated
- */
- public boolean isReadOnly() {
- return myReadOnly;
- }
-
- /**
- * @generated
- */
- public boolean isSynchronized() {
- return myUnSynchronizedResources.size() == 0;
- }
-
- /**
- * @generated
- */
- public boolean isUpdateCache() {
- return myUpdateCache;
- }
-
- /**
- * @generated
- */
- public void setModifiable(boolean modifiable) {
- myModifiable = modifiable;
- }
-
- /**
- * @generated
- */
- public void setModificationStamp(long modificationStamp) {
- myModificationStamp = modificationStamp;
- }
-
- /**
- * @generated
- */
- public void setReadOnly(boolean readOnly) {
- myReadOnly = readOnly;
- }
-
- /**
- * @generated
- */
- public void setSynchronized(Resource resource) {
- myUnSynchronizedResources.remove(resource);
- }
-
- /**
- * @generated
- */
- public void setUnSynchronized(Resource resource) {
- myUnSynchronizedResources.add(resource);
- }
-
- /**
- * @generated
- */
- public void setUpdateCache(boolean update) {
- myUpdateCache = update;
- }
-
- /**
- * @generated
- */
- public final void startResourceListening() {
- mySynchronizer = new WorkspaceSynchronizer(getEditingDomain(), new SynchronizerDelegate());
- }
-
- /**
- * @generated
- */
- public final void stopResourceListening() {
- mySynchronizer.dispose();
- mySynchronizer = null;
- }
-
- }
-
- /**
- * @generated
- */
- private class ResourceSetModificationListener extends EContentAdapter {
-
- /**
- * @generated
- */
- private NotificationFilter myModifiedFilter;
-
- /**
- * @generated
- */
- private ResourceSetInfo myInfo;
-
- /**
- * @generated
- */
- public ResourceSetModificationListener(ResourceSetInfo info) {
- myInfo = info;
- myModifiedFilter = NotificationFilter.createEventTypeFilter(Notification.SET).or(NotificationFilter.createEventTypeFilter(Notification.UNSET)).and(NotificationFilter.createFeatureFilter(Resource.class, Resource.RESOURCE__IS_MODIFIED));
- }
-
- /**
- * @generated
- */
- public void notifyChanged(Notification notification) {
- if(notification.getNotifier() instanceof ResourceSet) {
- super.notifyChanged(notification);
- }
- if(!notification.isTouch() && myModifiedFilter.matches(notification)) {
- if(notification.getNotifier() instanceof Resource) {
- Resource resource = (Resource)notification.getNotifier();
- if(resource.isLoaded()) {
- boolean modified = false;
- for(Iterator/* <org.eclipse.emf.ecore.resource.Resource> */it = myInfo.getLoadedResourcesIterator(); it.hasNext() && !modified;) {
- Resource nextResource = (Resource)it.next();
- if(nextResource.isLoaded()) {
- modified = nextResource.isModified();
- }
- }
- boolean dirtyStateChanged = false;
- synchronized(myInfo) {
- if(modified != myInfo.fCanBeSaved) {
- myInfo.fCanBeSaved = modified;
- dirtyStateChanged = true;
- }
- if(!resource.isModified()) {
- myInfo.setSynchronized(resource);
- }
- }
- if(dirtyStateChanged) {
- fireElementDirtyStateChanged(myInfo.getEditorInput(), modified);
-
- if(!modified) {
- myInfo.setModificationStamp(computeModificationStamp(myInfo));
- }
- }
- }
- }
- }
- }
-
- }
-
- /**
- * @generated
- */
- private long computeModificationStamp(ResourceSetInfo info) {
- int result = 0;
- for(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
- Resource nextResource = it.next();
- IFile file = WorkspaceSynchronizer.getFile(nextResource);
- if(file != null) {
- if(file.getLocation() != null) {
- result += file.getLocation().toFile().lastModified();
- } else {
- result += file.getModificationStamp();
- }
- }
- }
- return result;
- }
-
- /**
- * @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
- */
- protected IDocument createDocument(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));
- }
- IDocument document = createEmptyDocument();
- setDocumentContent(document, (IEditorInput)element);
- setupDocument(element, document);
- return document;
- }
-
- /**
- * @generated
- */
- private TransactionalEditingDomain createEditingDomain() {
- TransactionalEditingDomain editingDomain = DiagramEditingDomainFactory.getInstance().createEditingDomain();
- editingDomain.setID("org.eclipse.papyrus.diagram.statemachine.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 myTarger;
- }
-
- public boolean isAdapterForType(Object type) {
- return false;
- }
-
- public void notifyChanged(Notification notification) {
- if(diagramResourceModifiedFilter.matches(notification)) {
- Object value = notification.getNewValue();
- if(value instanceof Resource) {
- ((Resource)value).setTrackingModification(true);
- }
- }
- }
-
- public void setTarget(Notifier newTarget) {
- myTarger = newTarget;
- }
-
- });
-
- return editingDomain;
- }
-
- /**
- * @generated
- */
- protected ElementInfo createElementInfo(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));
- }
- IEditorInput editorInput = (IEditorInput)element;
- IDiagramDocument document = (IDiagramDocument)createDocument(editorInput);
-
- ResourceSetInfo info = new ResourceSetInfo(document, editorInput);
- info.setModificationStamp(computeModificationStamp(info));
- info.fStatus = null;
- return info;
- }
-
- /**
- * @generated
- */
- protected IDocument createEmptyDocument() {
- DiagramDocument document = new DiagramDocument();
- document.setEditingDomain(createEditingDomain());
- return document;
- }
-
- /**
- * @generated
- */
- public IEditorInput createInputWithEditingDomain(IEditorInput editorInput, TransactionalEditingDomain domain) {
- return editorInput;
- }
-
- /**
- * @generated
- */
- protected void disposeElementInfo(Object element, ElementInfo info) {
- if(info instanceof ResourceSetInfo) {
- ResourceSetInfo resourceSetInfo = (ResourceSetInfo)info;
- resourceSetInfo.dispose();
- }
- super.disposeElementInfo(element, info);
- }
-
- /**
- * @generated
- */
- protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException {
- 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(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
- 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 (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 (RuntimeException x) {
- fireElementStateChangeFailed(element);
- throw x;
- } finally {
- info.startResourceListening();
- }
- } else {
- URI newResoruceURI;
- List<IFile> affectedFiles = null;
- if(element instanceof FileEditorInput) {
- 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$
- }
- IDiagramDocument diagramDocument = (IDiagramDocument)document;
- final Resource newResource = diagramDocument.getEditingDomain().getResourceSet().createResource(newResoruceURI);
- final Diagram diagramCopy = (Diagram)EcoreUtil.copy(diagramDocument.getDiagram());
- try {
- new AbstractTransactionalCommand(diagramDocument.getEditingDomain(), NLS.bind(Messages.UMLDocumentProvider_SaveAsOperation, diagramCopy.getName()), affectedFiles) {
-
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- newResource.getContents().add(diagramCopy);
- return CommandResult.newOKCommandResult();
- }
- }.execute(monitor, null);
- newResource.save(UMLDiagramEditorUtil.getSaveOptions());
- } catch (ExecutionException e) {
- fireElementStateChangeFailed(element);
- throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, e.getLocalizedMessage(), null));
- } catch (IOException e) {
- fireElementStateChangeFailed(element);
- throw new CoreException(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, 0, e.getLocalizedMessage(), null));
- }
- newResource.unload();
- }
- }
-
- /**
- * @generated
- */
- protected void doSynchronize(Object element, IProgressMonitor monitor) throws CoreException {
- ResourceSetInfo info = getResourceSetInfo(element);
- if(info != null) {
- for(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
- Resource nextResource = it.next();
- handleElementChanged(info, nextResource, monitor);
- }
- return;
- }
- super.doSynchronize(element, monitor);
- }
-
- /**
- * @generated
- */
- protected void doUpdateStateCache(Object element) throws CoreException {
- ResourceSetInfo info = getResourceSetInfo(element);
- if(info != null) {
- info.setUpdateCache(true);
- }
- super.doUpdateStateCache(element);
- }
-
- /**
- * @generated
- */
- protected void doValidateState(Object element, Object computationContext) throws CoreException {
- ResourceSetInfo info = getResourceSetInfo(element);
- if(info != null) {
- LinkedList<IFile> files2Validate = new LinkedList<IFile>();
- for(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
- Resource nextResource = it.next();
- IFile file = WorkspaceSynchronizer.getFile(nextResource);
- if(file != null && file.isReadOnly()) {
- files2Validate.add(file);
- }
- }
- ResourcesPlugin.getWorkspace().validateEdit((IFile[])files2Validate.toArray(new IFile[files2Validate.size()]), computationContext);
- }
-
- super.doValidateState(element, computationContext);
- }
-
- /**
- * @generated
- */
- public IDiagramDocument getDiagramDocument(Object element) {
- IDocument doc = getDocument(element);
- if(doc instanceof IDiagramDocument) {
- return (IDiagramDocument)doc;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public long getModificationStamp(Object element) {
- ResourceSetInfo info = getResourceSetInfo(element);
- if(info != null) {
- return computeModificationStamp(info);
- }
- return super.getModificationStamp(element);
- }
-
- /**
- * @generated
- */
- protected IRunnableContext getOperationRunner(IProgressMonitor monitor) {
- return null;
- }
-
- /**
- * @generated
- */
- protected ISchedulingRule getResetRule(Object element) {
- ResourceSetInfo info = getResourceSetInfo(element);
- if(info != null) {
- LinkedList<ISchedulingRule> rules = new LinkedList<ISchedulingRule>();
- for(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
- Resource nextResource = it.next();
- IFile file = WorkspaceSynchronizer.getFile(nextResource);
- if(file != null) {
- rules.add(ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(file));
- }
- }
- return new MultiRule((ISchedulingRule[])rules.toArray(new ISchedulingRule[rules.size()]));
- }
- return null;
- }
-
- /**
- * @generated
- */
- public ResourceSetInfo getResourceSetInfo(Object editorInput) {
- return (ResourceSetInfo)super.getElementInfo(editorInput);
- }
-
- /**
- * @generated
- */
- protected ISchedulingRule getSaveRule(Object element) {
- ResourceSetInfo info = getResourceSetInfo(element);
- if(info != null) {
- LinkedList<ISchedulingRule> rules = new LinkedList<ISchedulingRule>();
- for(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
- Resource nextResource = it.next();
- IFile file = WorkspaceSynchronizer.getFile(nextResource);
- if(file != null) {
- rules.add(computeSchedulingRule(file));
- }
- }
- return new MultiRule((ISchedulingRule[])rules.toArray(new ISchedulingRule[rules.size()]));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected ISchedulingRule getSynchronizeRule(Object element) {
- ResourceSetInfo info = getResourceSetInfo(element);
- if(info != null) {
- LinkedList<ISchedulingRule> rules = new LinkedList<ISchedulingRule>();
- for(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
- Resource nextResource = it.next();
- IFile file = WorkspaceSynchronizer.getFile(nextResource);
- if(file != null) {
- rules.add(ResourcesPlugin.getWorkspace().getRuleFactory().refreshRule(file));
- }
- }
- return new MultiRule((ISchedulingRule[])rules.toArray(new ISchedulingRule[rules.size()]));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected ISchedulingRule getValidateStateRule(Object element) {
- ResourceSetInfo info = getResourceSetInfo(element);
- if(info != null) {
- LinkedList<ISchedulingRule> files = new LinkedList<ISchedulingRule>();
- for(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
- Resource nextResource = it.next();
- IFile file = WorkspaceSynchronizer.getFile(nextResource);
- if(file != null) {
- files.add(file);
- }
- }
- return ResourcesPlugin.getWorkspace().getRuleFactory().validateEditRule((IFile[])files.toArray(new IFile[files.size()]));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected void handleElementChanged(ResourceSetInfo info, Resource changedResource, IProgressMonitor monitor) {
- IFile file = WorkspaceSynchronizer.getFile(changedResource);
- if(file != null) {
- try {
- file.refreshLocal(IResource.DEPTH_INFINITE, monitor);
- } catch (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 (CoreException e) {
- info.fStatus = e.getStatus();
- }
- if(!info.fCanBeSaved) {
- info.setModificationStamp(computeModificationStamp(info));
- }
- addUnchangedElementListeners(info.getEditorInput(), info);
- fireElementContentReplaced(info.getEditorInput());
- }
-
- /**
- * @generated
- */
- protected void handleElementMoved(IEditorInput input, URI uri) {
- if(input instanceof FileEditorInput) {
- 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 boolean isDeleted(Object element) {
- IDiagramDocument document = getDiagramDocument(element);
- if(document != null) {
- Resource diagramResource = document.getDiagram().eResource();
- if(diagramResource != null) {
- IFile file = WorkspaceSynchronizer.getFile(diagramResource);
- return file == null || file.getLocation() == null || !file.getLocation().toFile().exists();
- }
- }
- return super.isDeleted(element);
- }
-
- /**
- * @generated
- */
- public boolean isModifiable(Object element) {
- if(!isStateValidated(element)) {
- if(element instanceof FileEditorInput || element instanceof URIEditorInput) {
- return true;
- }
- }
- ResourceSetInfo info = getResourceSetInfo(element);
- if(info != null) {
- if(info.isUpdateCache()) {
- try {
- updateCache(element);
- } catch (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
- */
- public boolean isReadOnly(Object element) {
- ResourceSetInfo info = getResourceSetInfo(element);
- if(info != null) {
- if(info.isUpdateCache()) {
- try {
- updateCache(element);
- } catch (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
- */
- public boolean isSynchronized(Object element) {
- ResourceSetInfo info = getResourceSetInfo(element);
- if(info != null) {
- return info.isSynchronized();
- }
- return super.isSynchronized(element);
- }
-
- /**
- * @generated
- */
- protected void setDocumentContent(IDocument document, IEditorInput element) throws CoreException {
- IDiagramDocument diagramDocument = (IDiagramDocument)document;
- TransactionalEditingDomain domain = diagramDocument.getEditingDomain();
- if(element instanceof FileEditorInput) {
- IStorage storage = ((FileEditorInput)element).getStorage();
- Diagram diagram = DiagramIOUtil.load(domain, storage, true, getProgressMonitor());
- document.setContent(diagram);
- } else if(element instanceof URIEditorInput) {
- 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 {
- 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 (IOException e) {
- resource.unload();
- throw e;
- }
- }
- if(uri.fragment() != null) {
- EObject rootElement = resource.getEObject(uri.fragment());
- if(rootElement instanceof Diagram) {
- document.setContent((Diagram)rootElement);
- return;
- }
- } else {
- for(Iterator it = resource.getContents().iterator(); it.hasNext();) {
- Object rootElement = it.next();
- if(rootElement instanceof Diagram) {
- document.setContent((Diagram)rootElement);
- return;
- }
- }
- }
- throw new RuntimeException(Messages.UMLDocumentProvider_NoDiagramInResourceError);
- } catch (Exception e) {
- CoreException thrownExcp = null;
- if(e instanceof CoreException) {
- thrownExcp = (CoreException)e;
- } else {
- 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));
- }
- }
-
- /**
- * 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(Object element, IDocument document) {
- // for subclasses
- }
-
- /**
- * @generated
- */
- protected void updateCache(Object element) throws CoreException {
- ResourceSetInfo info = getResourceSetInfo(element);
- if(info != null) {
- for(Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
- Resource nextResource = it.next();
- IFile file = WorkspaceSynchronizer.getFile(nextResource);
- if(file != null && file.isReadOnly()) {
- info.setReadOnly(true);
- info.setModifiable(false);
- return;
- }
- }
- info.setReadOnly(false);
- info.setModifiable(true);
- return;
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLInitDiagramFileAction.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLInitDiagramFileAction.java
deleted file mode 100644
index 07004da5af6..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLInitDiagramFileAction.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.gmf.runtime.emf.core.GMFEditingDomainFactory;
-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.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * @generated
- */
-public class UMLInitDiagramFileAction implements IObjectActionDelegate {
-
- /**
- * @generated
- */
- private IWorkbenchPart targetPart;
-
- /**
- * @generated
- */
- private URI domainModelURI;
-
- /**
- * @generated
- */
- private Shell getShell() {
- return targetPart.getSite().getShell();
- }
-
- /**
- * @generated
- */
- public void run(IAction action) {
- TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE.createEditingDomain();
- ResourceSet resourceSet = editingDomain.getResourceSet();
- EObject diagramRoot = null;
- try {
- Resource resource = resourceSet.getResource(domainModelURI, true);
- diagramRoot = (EObject)resource.getContents().get(0);
- } catch (WrappedException ex) {
- UMLDiagramEditorPlugin.getInstance().logError("Unable to load resource: " + domainModelURI, ex); //$NON-NLS-1$
- }
- if(diagramRoot == null) {
- MessageDialog.openError(getShell(), Messages.InitDiagramFile_ResourceErrorDialogTitle, Messages.InitDiagramFile_ResourceErrorDialogMessage);
- return;
- }
- Wizard wizard = new UMLNewDiagramFileWizard(domainModelURI, diagramRoot, editingDomain);
- wizard.setWindowTitle(NLS.bind(Messages.InitDiagramFile_WizardTitle, PackageEditPart.MODEL_ID));
- UMLDiagramEditorUtil.runWizard(getShell(), wizard, "InitDiagramFile"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- public void selectionChanged(IAction action, ISelection selection) {
- domainModelURI = null;
- action.setEnabled(false);
- if(selection instanceof IStructuredSelection == false || selection.isEmpty()) {
- return;
- }
- IFile file = (IFile)((IStructuredSelection)selection).getFirstElement();
- domainModelURI = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
- action.setEnabled(true);
- }
-
- /**
- * @generated
- */
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- this.targetPart = targetPart;
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLLinkDescriptor.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLLinkDescriptor.java
deleted file mode 100644
index da209e29cd9..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLLinkDescriptor.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.part;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-
-/**
- * @generated
- */
-public class UMLLinkDescriptor extends UMLNodeDescriptor {
-
- /**
- * @generated
- */
- private EObject mySource;
-
- /**
- * @generated
- */
- private EObject myDestination;
-
- /**
- * @generated
- */
- private IAdaptable mySemanticAdapter;
-
- /**
- * @generated
- */
- public UMLLinkDescriptor(EObject source, EObject destination, EObject linkElement, IElementType elementType, int linkVID) {
- this(source, destination, linkElement, linkVID);
- final IElementType elementTypeCopy = elementType;
- mySemanticAdapter = new EObjectAdapter(linkElement) {
-
- public Object getAdapter(Class adapter) {
- if(IElementType.class.equals(adapter)) {
- return elementTypeCopy;
- }
- return super.getAdapter(adapter);
- }
- };
- }
-
- /**
- * @generated
- */
- private UMLLinkDescriptor(EObject source, EObject destination, EObject linkElement, int linkVID) {
- super(linkElement, linkVID);
- mySource = source;
- myDestination = destination;
- }
-
- /**
- * @generated
- */
- public UMLLinkDescriptor(EObject source, EObject destination, IElementType elementType, int linkVID) {
- this(source, destination, (EObject)null, linkVID);
- final IElementType elementTypeCopy = elementType;
- mySemanticAdapter = new IAdaptable() {
-
- public Object getAdapter(Class adapter) {
- if(IElementType.class.equals(adapter)) {
- return elementTypeCopy;
- }
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- public EObject getDestination() {
- return myDestination;
- }
-
- /**
- * @generated
- */
- public IAdaptable getSemanticAdapter() {
- return mySemanticAdapter;
- }
-
- /**
- * @generated
- */
- public EObject getSource() {
- return mySource;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLMatchingStrategy.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLMatchingStrategy.java
deleted file mode 100644
index bc305e9548e..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLMatchingStrategy.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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
- */
-public class UMLMatchingStrategy implements IEditorMatchingStrategy {
-
- /**
- * @generated
- */
- public boolean matches(IEditorReference editorRef, IEditorInput input) {
- IEditorInput editorInput;
- try {
- editorInput = editorRef.getEditorInput();
- } catch (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/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLNewDiagramFileWizard.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLNewDiagramFileWizard.java
deleted file mode 100644
index 9b4f7dff8de..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLNewDiagramFileWizard.java
+++ /dev/null
@@ -1,161 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
-
-/**
- * @generated
- */
-public class UMLNewDiagramFileWizard extends Wizard {
-
- /**
- * @generated
- */
- private static class DiagramRootElementSelectionPage extends ModelElementSelectionPage {
-
- /**
- * @generated
- */
- protected DiagramRootElementSelectionPage(String pageName) {
- super(pageName);
- }
-
- /**
- * @generated
- */
- protected String getSelectionTitle() {
- return Messages.UMLNewDiagramFileWizard_RootSelectionPageSelectionTitle;
- }
-
- /**
- * @generated
- */
- protected boolean validatePage() {
- if(selectedModelElement == null) {
- setErrorMessage(Messages.UMLNewDiagramFileWizard_RootSelectionPageNoSelectionMessage);
- return false;
- }
- boolean result = ViewService.getInstance().provides(new CreateDiagramViewOperation(new EObjectAdapter(selectedModelElement), PackageEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT));
- setErrorMessage(result ? null : Messages.UMLNewDiagramFileWizard_RootSelectionPageInvalidSelectionMessage);
- return result;
- }
- }
-
- /**
- * @generated
- */
- private WizardNewFileCreationPage myFileCreationPage;
-
- /**
- * @generated
- */
- private ModelElementSelectionPage diagramRootElementSelectionPage;
-
- /**
- * @generated
- */
- private TransactionalEditingDomain myEditingDomain;
-
- /**
- * @generated
- */
- public UMLNewDiagramFileWizard(URI domainModelURI, EObject diagramRoot, 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$
-
- myFileCreationPage = new WizardNewFileCreationPage(Messages.UMLNewDiagramFileWizard_CreationPageName, StructuredSelection.EMPTY);
- myFileCreationPage.setTitle(Messages.UMLNewDiagramFileWizard_CreationPageTitle);
- myFileCreationPage.setDescription(NLS.bind(Messages.UMLNewDiagramFileWizard_CreationPageDescription, PackageEditPart.MODEL_ID));
- IPath filePath;
- 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$
- }
- myFileCreationPage.setContainerFullPath(filePath);
- myFileCreationPage.setFileName(UMLDiagramEditorUtil.getUniqueFileName(filePath, fileName, "PapyrusUMLStateMachine_diagram")); //$NON-NLS-1$
-
- diagramRootElementSelectionPage = new DiagramRootElementSelectionPage(Messages.UMLNewDiagramFileWizard_RootSelectionPageName);
- diagramRootElementSelectionPage.setTitle(Messages.UMLNewDiagramFileWizard_RootSelectionPageTitle);
- diagramRootElementSelectionPage.setDescription(Messages.UMLNewDiagramFileWizard_RootSelectionPageDescription);
- diagramRootElementSelectionPage.setModelElement(diagramRoot);
-
- myEditingDomain = editingDomain;
- }
-
- /**
- * @generated
- */
- public void addPages() {
- addPage(myFileCreationPage);
- addPage(diagramRootElementSelectionPage);
- }
-
- /**
- * @generated
- */
- public boolean performFinish() {
- LinkedList<IFile> affectedFiles = new LinkedList<IFile>();
- IFile diagramFile = myFileCreationPage.createNewFile();
- UMLDiagramEditorUtil.setCharset(diagramFile);
- affectedFiles.add(diagramFile);
- URI diagramModelURI = URI.createPlatformResourceURI(diagramFile.getFullPath().toString(), true);
- ResourceSet resourceSet = myEditingDomain.getResourceSet();
- final Resource diagramResource = resourceSet.createResource(diagramModelURI);
- AbstractTransactionalCommand command = new AbstractTransactionalCommand(myEditingDomain, Messages.UMLNewDiagramFileWizard_InitDiagramCommand, affectedFiles) {
-
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- int diagramVID = UMLVisualIDRegistry.getDiagramVisualID(diagramRootElementSelectionPage.getModelElement());
- if(diagramVID != PackageEditPart.VISUAL_ID) {
- return CommandResult.newErrorCommandResult(Messages.UMLNewDiagramFileWizard_IncorrectRootError);
- }
- Diagram diagram = ViewService.createDiagram(diagramRootElementSelectionPage.getModelElement(), PackageEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
- diagramResource.getContents().add(diagram);
- return CommandResult.newOKCommandResult();
- }
- };
- try {
- OperationHistoryFactory.getOperationHistory().execute(command, new NullProgressMonitor(), null);
- diagramResource.save(UMLDiagramEditorUtil.getSaveOptions());
- UMLDiagramEditorUtil.openDiagram(diagramResource);
- } catch (ExecutionException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Unable to create model and diagram", e); //$NON-NLS-1$
- } catch (IOException ex) {
- UMLDiagramEditorPlugin.getInstance().logError("Save operation failed for: " + diagramModelURI, ex); //$NON-NLS-1$
- } catch (PartInitException ex) {
- UMLDiagramEditorPlugin.getInstance().logError("Unable to open editor", ex); //$NON-NLS-1$
- }
- return true;
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLNodeDescriptor.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLNodeDescriptor.java
deleted file mode 100644
index 521df51262c..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLNodeDescriptor.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.part;
-
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * @generated
- */
-public class UMLNodeDescriptor {
-
- /**
- * @generated
- */
- private final EObject myModelElement;
-
- /**
- * @generated
- */
- private final int myVisualID;
-
- /**
- * @generated
- */
- public UMLNodeDescriptor(EObject modelElement, int visualID) {
- myModelElement = modelElement;
- myVisualID = visualID;
- }
-
- /**
- * @generated
- */
- public EObject getModelElement() {
- return myModelElement;
- }
-
- /**
- * @generated
- */
- public int getVisualID() {
- return myVisualID;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLPaletteFactory.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLPaletteFactory.java
deleted file mode 100644
index 37264ab87db..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLPaletteFactory.java
+++ /dev/null
@@ -1,328 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.diagram.common.service.AspectUnspecifiedTypeConnectionTool;
-import org.eclipse.papyrus.diagram.common.service.AspectUnspecifiedTypeCreationTool;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class UMLPaletteFactory extends PaletteFactory.Adapter {
-
- /**
- * @generated
- */
- private final static String CREATEREGIONCREATIONTOOL = "createRegionCreationTool"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String CREATESTATECREATIONTOOL = "createStateCreationTool"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String CREATEINITIALCREATIONTOOL = "createInitialCreationTool"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String CREATEFINALSTATECREATIONTOOL = "createFinalStateCreationTool"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String CREATESHALLOWHISTORYCREATIONTOOL = "createShallowHistoryCreationTool"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String CREATEDEEPHISTORYCREATIONTOOL = "createDeepHistoryCreationTool"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String CREATEFORKCREATIONTOOL = "createForkCreationTool"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String CREATEJOINCREATIONTOOL = "createJoinCreationTool"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String CREATECHOICECREATIONTOOL = "createChoiceCreationTool"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String CREATEJUNCTIONCREATIONTOOL = "createJunctionCreationTool"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String CREATEENTRYPOINTCREATIONTOOL = "createEntryPointCreationTool"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String CREATEEXITPOINTCREATIONTOOL = "createExitPointCreationTool"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String CREATETERMINATECREATIONTOOL = "createTerminateCreationTool"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String CREATECONNECTIONPOINTREFERENCECREATIONTOOL = "createConnectionPointReferenceCreationTool"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String CREATETRANSITIONCREATIONTOOL = "createTransitionCreationTool"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- public UMLPaletteFactory() {
-
- }
-
- /**
- * @generated
- */
- private Tool createChoiceCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Pseudostate_11000);
-
- Tool tool = new AspectUnspecifiedTypeCreationTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createConnectionPointReferenceCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
-
- Tool tool = new AspectUnspecifiedTypeCreationTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createDeepHistoryCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Pseudostate_14000);
-
- Tool tool = new AspectUnspecifiedTypeCreationTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createEntryPointCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Pseudostate_16000);
-
- Tool tool = new AspectUnspecifiedTypeCreationTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createExitPointCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Pseudostate_17000);
-
- Tool tool = new AspectUnspecifiedTypeCreationTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createFinalStateCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.FinalState_5000);
-
- Tool tool = new AspectUnspecifiedTypeCreationTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createForkCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Pseudostate_10000);
-
- Tool tool = new AspectUnspecifiedTypeCreationTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createInitialCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Pseudostate_8000);
-
- Tool tool = new AspectUnspecifiedTypeCreationTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createJoinCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Pseudostate_9000);
-
- Tool tool = new AspectUnspecifiedTypeCreationTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createJunctionCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Pseudostate_12000);
-
- Tool tool = new AspectUnspecifiedTypeCreationTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createRegionCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Region_3000);
-
- Tool tool = new AspectUnspecifiedTypeCreationTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createShallowHistoryCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Pseudostate_13000);
-
- Tool tool = new AspectUnspecifiedTypeCreationTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createStateCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.State_6000);
-
- Tool tool = new AspectUnspecifiedTypeCreationTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createTerminateCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Pseudostate_15000);
-
- Tool tool = new AspectUnspecifiedTypeCreationTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- public Tool createTool(String toolId) {
- if(toolId.equals(CREATEREGIONCREATIONTOOL)) {
- return createRegionCreationTool();
- }
- if(toolId.equals(CREATESTATECREATIONTOOL)) {
- return createStateCreationTool();
- }
- if(toolId.equals(CREATEINITIALCREATIONTOOL)) {
- return createInitialCreationTool();
- }
- if(toolId.equals(CREATEFINALSTATECREATIONTOOL)) {
- return createFinalStateCreationTool();
- }
- if(toolId.equals(CREATESHALLOWHISTORYCREATIONTOOL)) {
- return createShallowHistoryCreationTool();
- }
- if(toolId.equals(CREATEDEEPHISTORYCREATIONTOOL)) {
- return createDeepHistoryCreationTool();
- }
- if(toolId.equals(CREATEFORKCREATIONTOOL)) {
- return createForkCreationTool();
- }
- if(toolId.equals(CREATEJOINCREATIONTOOL)) {
- return createJoinCreationTool();
- }
- if(toolId.equals(CREATECHOICECREATIONTOOL)) {
- return createChoiceCreationTool();
- }
- if(toolId.equals(CREATEJUNCTIONCREATIONTOOL)) {
- return createJunctionCreationTool();
- }
- if(toolId.equals(CREATEENTRYPOINTCREATIONTOOL)) {
- return createEntryPointCreationTool();
- }
- if(toolId.equals(CREATEEXITPOINTCREATIONTOOL)) {
- return createExitPointCreationTool();
- }
- if(toolId.equals(CREATETERMINATECREATIONTOOL)) {
- return createTerminateCreationTool();
- }
- if(toolId.equals(CREATECONNECTIONPOINTREFERENCECREATIONTOOL)) {
- return createConnectionPointReferenceCreationTool();
- }
- if(toolId.equals(CREATETRANSITIONCREATIONTOOL)) {
- return createTransitionCreationTool();
- }
-
- // default return: null
- return null;
- }
-
- /**
- * @generated
- */
- private Tool createTransitionCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Transition_7000);
-
- Tool tool = new AspectUnspecifiedTypeConnectionTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- public Object getTemplate(String templateId) {
-
- // default return: null
- return null;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLUriEditorInputTester.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLUriEditorInputTester.java
deleted file mode 100644
index 35214cd76f3..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLUriEditorInputTester.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.part;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.emf.common.ui.URIEditorInput;
-
-/**
- * @generated
- */
-public class UMLUriEditorInputTester extends PropertyTester {
-
- /**
- * @generated
- */
- public boolean test(Object receiver, String method, Object[] args, Object expectedValue) {
- if(false == receiver instanceof URIEditorInput) {
- return false;
- }
- URIEditorInput editorInput = (URIEditorInput)receiver;
- return "PapyrusUMLStateMachine_diagram".equals(editorInput.getURI().fileExtension()); //$NON-NLS-1$
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLVisualIDRegistry.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLVisualIDRegistry.java
deleted file mode 100644
index c6500cbf233..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/UMLVisualIDRegistry.java
+++ /dev/null
@@ -1,807 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.papyrus.diagram.common.providers.BaseViewInfo;
-import org.eclipse.papyrus.diagram.common.providers.ViewInfo;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.ConnectionPointReferenceEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.ConnectionPointReferenceNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.ConnectionPointReferenceStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.FinalStateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.FinalStateNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.FinalStateStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.GeneralizationStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateChoiceEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateChoiceNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateChoiceStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateDeepHistoryEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateDeepHistoryNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateDeepHistoryStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateForkEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateForkNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateForkStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateInitialEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateInitialNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateInitialStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJoinEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJoinNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJoinStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJunctionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJunctionNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJunctionStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateShallowHistoryEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateShallowHistoryNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateShallowHistoryStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateTerminateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateTerminateNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateTerminateStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionGuardEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionStereotypeEditPart;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.Pseudostate;
-import org.eclipse.uml2.uml.PseudostateKind;
-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
- */
-public class UMLVisualIDRegistry {
-
- /**
- * @generated
- */
- private static final String DEBUG_KEY = "org.eclipse.papyrus.diagram.statemachine/debug/visualID"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private static ViewInfo diagramViewInfo = null;
-
- /**
- * @generated
- */
- public static boolean canCreateNode(View containerView, int nodeVisualID) {
- String containerModelID = org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry.getModelID(containerView);
- if(!PackageEditPart.MODEL_ID.equals(containerModelID)) {
- return false;
- }
- int containerVisualID;
- if(PackageEditPart.MODEL_ID.equals(containerModelID)) {
- containerVisualID = org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry.getVisualID(containerView);
- } else {
- if(containerView instanceof Diagram) {
- containerVisualID = PackageEditPart.VISUAL_ID;
- } else {
- return false;
- }
- }
- switch(containerVisualID) {
- case PackageEditPart.VISUAL_ID:
- if(StateMachineEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case StateMachineEditPart.VISUAL_ID:
- if(StateMachineNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(StateMachineCompartmentEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PseudostateEntryPointEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PseudostateExitPointEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case RegionEditPart.VISUAL_ID:
- if(RegionCompartmentEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case FinalStateEditPart.VISUAL_ID:
- if(FinalStateNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(FinalStateStereotypeEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case StateEditPart.VISUAL_ID:
- if(StateNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(StateCompartmentEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(RegionEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PseudostateEntryPointEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PseudostateExitPointEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(ConnectionPointReferenceEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case PseudostateInitialEditPart.VISUAL_ID:
- if(PseudostateInitialNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PseudostateInitialStereotypeEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case PseudostateJoinEditPart.VISUAL_ID:
- if(PseudostateJoinNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PseudostateJoinStereotypeEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case PseudostateForkEditPart.VISUAL_ID:
- if(PseudostateForkNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PseudostateForkStereotypeEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case PseudostateChoiceEditPart.VISUAL_ID:
- if(PseudostateChoiceNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PseudostateChoiceStereotypeEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case PseudostateJunctionEditPart.VISUAL_ID:
- if(PseudostateJunctionNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PseudostateJunctionStereotypeEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case PseudostateShallowHistoryEditPart.VISUAL_ID:
- if(PseudostateShallowHistoryNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PseudostateShallowHistoryStereotypeEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case PseudostateDeepHistoryEditPart.VISUAL_ID:
- if(PseudostateDeepHistoryNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PseudostateDeepHistoryStereotypeEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case PseudostateTerminateEditPart.VISUAL_ID:
- if(PseudostateTerminateNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PseudostateTerminateStereotypeEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case PseudostateEntryPointEditPart.VISUAL_ID:
- if(PseudostateEntryPointNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PseudostateEntryPointStereotypeEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case PseudostateExitPointEditPart.VISUAL_ID:
- if(PseudostateExitPointNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PseudostateExitPointStereotypeEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case ConnectionPointReferenceEditPart.VISUAL_ID:
- if(ConnectionPointReferenceNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(ConnectionPointReferenceStereotypeEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case RegionCompartmentEditPart.VISUAL_ID:
- if(PseudostateInitialEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PseudostateJoinEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PseudostateForkEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PseudostateChoiceEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PseudostateJunctionEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PseudostateShallowHistoryEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PseudostateDeepHistoryEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PseudostateTerminateEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(FinalStateEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(StateEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PseudostateEntryPointEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PseudostateExitPointEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case StateMachineCompartmentEditPart.VISUAL_ID:
- if(RegionEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PseudostateEntryPointEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(PseudostateExitPointEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case StateCompartmentEditPart.VISUAL_ID:
- if(RegionEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(ConnectionPointReferenceEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case TransitionEditPart.VISUAL_ID:
- if(TransitionNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(TransitionGuardEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if(TransitionStereotypeEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case GeneralizationEditPart.VISUAL_ID:
- if(GeneralizationStereotypeEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- }
- return false;
- }
-
- /**
- * @generated
- */
- public static ViewInfo getDiagramViewInfo() {
- if(diagramViewInfo == null) {
- diagramViewInfo = getPackage_1000ViewInfo();
- }
- return diagramViewInfo;
- }
-
- /**
- * @generated
- */
- public static int getDiagramVisualID(EObject domainElement) {
- if(domainElement == null) {
- return -1;
- }
- if(UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass()) && isDiagram((Package)domainElement)) {
- return PackageEditPart.VISUAL_ID;
- }
-
- return -1;
- }
-
- /**
- * @generated
- */
- public static int getLinkWithClassVisualID(EObject domainElement) {
- if(domainElement == null) {
- return -1;
- }
- if(UMLPackage.eINSTANCE.getTransition().isSuperTypeOf(domainElement.eClass())
-
- ) {
- return TransitionEditPart.VISUAL_ID;
- }
- if(UMLPackage.eINSTANCE.getGeneralization().isSuperTypeOf(domainElement.eClass())
-
- ) {
- return GeneralizationEditPart.VISUAL_ID;
- }
- return -1;
- }
-
- /**
- * @generated
- */
- public static String getModelID(View view) {
- View diagram = view.getDiagram();
- while(view != diagram) {
- EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
- if(annotation != null) {
- return (String)annotation.getDetails().get("modelID"); //$NON-NLS-1$
- }
- view = (View)view.eContainer();
- }
- return diagram != null ? diagram.getType() : null;
- }
-
- /**
- * @generated
- */
- public static int getNodeVisualID(View containerView, EObject domainElement) {
- if(domainElement == null) {
- return -1;
- }
- String containerModelID = org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry.getModelID(containerView);
- if(!PackageEditPart.MODEL_ID.equals(containerModelID)) {
- return -1;
- }
- int containerVisualID;
- if(PackageEditPart.MODEL_ID.equals(containerModelID)) {
- containerVisualID = org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry.getVisualID(containerView);
- } else {
- if(containerView instanceof Diagram) {
- containerVisualID = PackageEditPart.VISUAL_ID;
- } else {
- return -1;
- }
- }
- switch(containerVisualID) {
- case PackageEditPart.VISUAL_ID:
- if(UMLPackage.eINSTANCE.getStateMachine().isSuperTypeOf(domainElement.eClass())
-
- ) {
- return StateMachineEditPart.VISUAL_ID;
- }
- break;
- case StateMachineEditPart.VISUAL_ID:
- if(UMLPackage.eINSTANCE.getPseudostate().isSuperTypeOf(domainElement.eClass()) && isPseudostate_16000(containerView, (Pseudostate)domainElement)) {
- return PseudostateEntryPointEditPart.VISUAL_ID;
- }
- if(UMLPackage.eINSTANCE.getPseudostate().isSuperTypeOf(domainElement.eClass()) && isPseudostate_17000(containerView, (Pseudostate)domainElement)) {
- return PseudostateExitPointEditPart.VISUAL_ID;
- }
- break;
- case StateEditPart.VISUAL_ID:
- if(UMLPackage.eINSTANCE.getRegion().isSuperTypeOf(domainElement.eClass())
-
- ) {
- return RegionEditPart.VISUAL_ID;
- }
- if(UMLPackage.eINSTANCE.getPseudostate().isSuperTypeOf(domainElement.eClass()) && isPseudostate_16000(containerView, (Pseudostate)domainElement)) {
- return PseudostateEntryPointEditPart.VISUAL_ID;
- }
- if(UMLPackage.eINSTANCE.getPseudostate().isSuperTypeOf(domainElement.eClass()) && isPseudostate_17000(containerView, (Pseudostate)domainElement)) {
- return PseudostateExitPointEditPart.VISUAL_ID;
- }
- if(UMLPackage.eINSTANCE.getConnectionPointReference().isSuperTypeOf(domainElement.eClass())
-
- ) {
- return ConnectionPointReferenceEditPart.VISUAL_ID;
- }
- break;
- case RegionCompartmentEditPart.VISUAL_ID:
- if(UMLPackage.eINSTANCE.getPseudostate().isSuperTypeOf(domainElement.eClass()) && isPseudostate_8000(containerView, (Pseudostate)domainElement)) {
- return PseudostateInitialEditPart.VISUAL_ID;
- }
- if(UMLPackage.eINSTANCE.getPseudostate().isSuperTypeOf(domainElement.eClass()) && isPseudostate_9000(containerView, (Pseudostate)domainElement)) {
- return PseudostateJoinEditPart.VISUAL_ID;
- }
- if(UMLPackage.eINSTANCE.getPseudostate().isSuperTypeOf(domainElement.eClass()) && isPseudostate_10000(containerView, (Pseudostate)domainElement)) {
- return PseudostateForkEditPart.VISUAL_ID;
- }
- if(UMLPackage.eINSTANCE.getPseudostate().isSuperTypeOf(domainElement.eClass()) && isPseudostate_11000(containerView, (Pseudostate)domainElement)) {
- return PseudostateChoiceEditPart.VISUAL_ID;
- }
- if(UMLPackage.eINSTANCE.getPseudostate().isSuperTypeOf(domainElement.eClass()) && isPseudostate_12000(containerView, (Pseudostate)domainElement)) {
- return PseudostateJunctionEditPart.VISUAL_ID;
- }
- if(UMLPackage.eINSTANCE.getPseudostate().isSuperTypeOf(domainElement.eClass()) && isPseudostate_13000(containerView, (Pseudostate)domainElement)) {
- return PseudostateShallowHistoryEditPart.VISUAL_ID;
- }
- if(UMLPackage.eINSTANCE.getPseudostate().isSuperTypeOf(domainElement.eClass()) && isPseudostate_14000(containerView, (Pseudostate)domainElement)) {
- return PseudostateDeepHistoryEditPart.VISUAL_ID;
- }
- if(UMLPackage.eINSTANCE.getPseudostate().isSuperTypeOf(domainElement.eClass()) && isPseudostate_15000(containerView, (Pseudostate)domainElement)) {
- return PseudostateTerminateEditPart.VISUAL_ID;
- }
- if(UMLPackage.eINSTANCE.getFinalState().isSuperTypeOf(domainElement.eClass())
-
- ) {
- return FinalStateEditPart.VISUAL_ID;
- }
- if(UMLPackage.eINSTANCE.getState().isSuperTypeOf(domainElement.eClass())
-
- ) {
- return StateEditPart.VISUAL_ID;
- }
- if(UMLPackage.eINSTANCE.getPseudostate().isSuperTypeOf(domainElement.eClass()) && isPseudostate_16000(containerView, (Pseudostate)domainElement)) {
- return PseudostateEntryPointEditPart.VISUAL_ID;
- }
- if(UMLPackage.eINSTANCE.getPseudostate().isSuperTypeOf(domainElement.eClass()) && isPseudostate_17000(containerView, (Pseudostate)domainElement)) {
- return PseudostateExitPointEditPart.VISUAL_ID;
- }
- break;
- case StateMachineCompartmentEditPart.VISUAL_ID:
- if(UMLPackage.eINSTANCE.getRegion().isSuperTypeOf(domainElement.eClass())
-
- ) {
- return RegionEditPart.VISUAL_ID;
- }
- if(UMLPackage.eINSTANCE.getPseudostate().isSuperTypeOf(domainElement.eClass()) && isPseudostate_16000(containerView, (Pseudostate)domainElement)) {
- return PseudostateEntryPointEditPart.VISUAL_ID;
- }
- if(UMLPackage.eINSTANCE.getPseudostate().isSuperTypeOf(domainElement.eClass()) && isPseudostate_17000(containerView, (Pseudostate)domainElement)) {
- return PseudostateExitPointEditPart.VISUAL_ID;
- }
- break;
- case StateCompartmentEditPart.VISUAL_ID:
- if(UMLPackage.eINSTANCE.getRegion().isSuperTypeOf(domainElement.eClass())
-
- ) {
- return RegionEditPart.VISUAL_ID;
- }
- if(UMLPackage.eINSTANCE.getConnectionPointReference().isSuperTypeOf(domainElement.eClass())
-
- ) {
- return ConnectionPointReferenceEditPart.VISUAL_ID;
- }
- break;
- }
- return -1;
- }
-
- /**
- * @generated
- */
- protected static ViewInfo getPackage_1000ViewInfo() {
- ViewInfo root = new BaseViewInfo(1000, ViewInfo.Head, "", null, null);
- ViewInfo viewInfo = null;
- ViewInfo labelInfo = null;
-
- viewInfo = new BaseViewInfo(2000, ViewInfo.Node, "StateMachine");
- root.addNode(1000, viewInfo);
-
- viewInfo = new BaseViewInfo(7000, ViewInfo.Edge, "");
- root.addNode(1000, viewInfo);
-
- labelInfo = new BaseViewInfo(7001, ViewInfo.Label, "", null, viewInfo);
- viewInfo.getChildren().add(labelInfo);
-
- labelInfo = new BaseViewInfo(7002, ViewInfo.Label, "", null, viewInfo);
- viewInfo.getChildren().add(labelInfo);
-
- labelInfo = new BaseViewInfo(7003, ViewInfo.Label, "", null, viewInfo);
- viewInfo.getChildren().add(labelInfo);
-
- viewInfo = new BaseViewInfo(19000, ViewInfo.Edge, "");
- root.addNode(1000, viewInfo);
-
- labelInfo = new BaseViewInfo(19002, ViewInfo.Label, "", null, viewInfo);
- viewInfo.getChildren().add(labelInfo);
-
- viewInfo = new BaseViewInfo(3000, ViewInfo.Node, "Region");
-
- root.addNode(2002, viewInfo);
-
- root.addNode(6002, viewInfo);
-
- root.addNode(6000, viewInfo);
-
- viewInfo = new BaseViewInfo(5000, ViewInfo.Node, "FinalState");
-
- root.addNode(3002, viewInfo);
-
- viewInfo = new BaseViewInfo(6000, ViewInfo.Node, "State");
-
- root.addNode(3002, viewInfo);
-
- viewInfo = new BaseViewInfo(8000, ViewInfo.Node, "Pseudostate");
-
- root.addNode(3002, viewInfo);
-
- viewInfo = new BaseViewInfo(9000, ViewInfo.Node, "Pseudostate");
-
- root.addNode(3002, viewInfo);
-
- viewInfo = new BaseViewInfo(10000, ViewInfo.Node, "Pseudostate");
-
- root.addNode(3002, viewInfo);
-
- viewInfo = new BaseViewInfo(11000, ViewInfo.Node, "Pseudostate");
-
- root.addNode(3002, viewInfo);
-
- viewInfo = new BaseViewInfo(12000, ViewInfo.Node, "Pseudostate");
-
- root.addNode(3002, viewInfo);
-
- viewInfo = new BaseViewInfo(13000, ViewInfo.Node, "Pseudostate");
-
- root.addNode(3002, viewInfo);
-
- viewInfo = new BaseViewInfo(14000, ViewInfo.Node, "Pseudostate");
-
- root.addNode(3002, viewInfo);
-
- viewInfo = new BaseViewInfo(15000, ViewInfo.Node, "Pseudostate");
-
- root.addNode(3002, viewInfo);
-
- viewInfo = new BaseViewInfo(16000, ViewInfo.Node, "Pseudostate");
-
- root.addNode(2000, viewInfo);
-
- root.addNode(3002, viewInfo);
-
- root.addNode(2002, viewInfo);
-
- root.addNode(6000, viewInfo);
-
- viewInfo = new BaseViewInfo(17000, ViewInfo.Node, "Pseudostate");
-
- root.addNode(3002, viewInfo);
-
- root.addNode(2002, viewInfo);
-
- root.addNode(2000, viewInfo);
-
- root.addNode(6000, viewInfo);
-
- viewInfo = new BaseViewInfo(18000, ViewInfo.Node, "ConnectionPointReference");
-
- root.addNode(6000, viewInfo);
-
- root.addNode(6002, viewInfo);
-
- return root;
- }
-
- /**
- * @generated
- */
- public static String getType(int visualID) {
- return Integer.toString(visualID);
- }
-
- /**
- * @generated
- */
- public static int getVisualID(String type) {
- try {
- return Integer.parseInt(type);
- } catch (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 int getVisualID(View view) {
- if(view instanceof Diagram) {
- if(PackageEditPart.MODEL_ID.equals(view.getType())) {
- return PackageEditPart.VISUAL_ID;
- } else {
- return -1;
- }
- }
- return org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry.getVisualID(view.getType());
- }
-
- /**
- * User can change implementation of this method to handle some specific
- * situations not covered by default logic.
- *
- * @generated
- */
- private static boolean isDiagram(Package element) {
- return true;
- }
-
- /**
- * @generated
- */
-
- private static boolean isPseudostate_10000(View containerView, Pseudostate domainElement) {
-
- // Test if the pseudostate is a fork
- if(domainElement instanceof Pseudostate) {
- PseudostateKind kind = ((Pseudostate)domainElement).getKind();
- if(kind.equals(PseudostateKind.FORK_LITERAL))
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
-
- private static boolean isPseudostate_11000(View containerView, Pseudostate domainElement) {
-
- // Test if the pseudostate is a choice
- if(domainElement instanceof Pseudostate) {
- PseudostateKind kind = ((Pseudostate)domainElement).getKind();
- if(kind.equals(PseudostateKind.CHOICE_LITERAL))
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
-
- private static boolean isPseudostate_12000(View containerView, Pseudostate domainElement) {
-
- // Test if the pseudostate is a junction
- if(domainElement instanceof Pseudostate) {
- PseudostateKind kind = ((Pseudostate)domainElement).getKind();
- if(kind.equals(PseudostateKind.JUNCTION_LITERAL))
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
-
- private static boolean isPseudostate_13000(View containerView, Pseudostate domainElement) {
-
- // Test if the pseudostate is a shallowHistory
- if(domainElement instanceof Pseudostate) {
- PseudostateKind kind = ((Pseudostate)domainElement).getKind();
- if(kind.equals(PseudostateKind.SHALLOW_HISTORY_LITERAL))
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
-
- private static boolean isPseudostate_14000(View containerView, Pseudostate domainElement) {
-
- // Test if the pseudostate is a deepHistory
- if(domainElement instanceof Pseudostate) {
- PseudostateKind kind = ((Pseudostate)domainElement).getKind();
- if(kind.equals(PseudostateKind.DEEP_HISTORY_LITERAL))
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
-
- private static boolean isPseudostate_15000(View containerView, Pseudostate domainElement) {
-
- // Test if the pseudostate is a terminate
- if(domainElement instanceof Pseudostate) {
- PseudostateKind kind = ((Pseudostate)domainElement).getKind();
- if(kind.equals(PseudostateKind.TERMINATE_LITERAL))
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
-
- private static boolean isPseudostate_16000(View containerView, Pseudostate domainElement) {
-
- // Test if the pseudostate is an entryPoint
- if(domainElement instanceof Pseudostate) {
- PseudostateKind kind = ((Pseudostate)domainElement).getKind();
- if(kind.equals(PseudostateKind.ENTRY_POINT_LITERAL))
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
-
- private static boolean isPseudostate_17000(View containerView, Pseudostate domainElement) {
-
- // Test if the pseudostate is an exitPoint
- if(domainElement instanceof Pseudostate) {
- PseudostateKind kind = ((Pseudostate)domainElement).getKind();
- if(kind.equals(PseudostateKind.EXIT_POINT_LITERAL))
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
-
- private static boolean isPseudostate_8000(View containerView, Pseudostate domainElement) {
-
- // Test if the pseudostate is an initial
- if(domainElement instanceof Pseudostate) {
- PseudostateKind kind = ((Pseudostate)domainElement).getKind();
- if(kind.equals(PseudostateKind.INITIAL_LITERAL))
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
-
- private static boolean isPseudostate_9000(View containerView, Pseudostate domainElement) {
-
- // Test if the pseudostate is a join
- if(domainElement instanceof Pseudostate) {
- PseudostateKind kind = ((Pseudostate)domainElement).getKind();
- if(kind.equals(PseudostateKind.JOIN_LITERAL))
- return true;
- }
- return false;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/ValidateAction.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/ValidateAction.java
deleted file mode 100644
index 061e27cc19a..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/part/ValidateAction.java
+++ /dev/null
@@ -1,251 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.diagram.statemachine.providers.UMLMarkerNavigationProvider;
-import org.eclipse.papyrus.diagram.statemachine.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
- */
-public class ValidateAction extends Action {
-
- /**
- * @generated
- */
- private static void addMarker(EditPartViewer viewer, IFile target, String elementId, String location, String message, int statusSeverity) {
- if(target == null) {
- return;
- }
- UMLMarkerNavigationProvider.addMarker(target, elementId, location, message, statusSeverity);
- }
-
- /**
- * @generated
- */
- private static Set<EObject> collectTargetElements(Diagnostic diagnostic, Set<EObject> targetElementCollector, List allDiagnostics) {
- 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(Iterator it = diagnostic.getChildren().iterator(); it.hasNext();) {
- collectTargetElements((Diagnostic)it.next(), targetElementCollector, allDiagnostics);
- }
- }
- return targetElementCollector;
- }
-
- /**
- * @generated
- */
- private static Set<EObject> collectTargetElements(IStatus status, Set<EObject> targetElementCollector, List allConstraintStatuses) {
- if(status instanceof IConstraintStatus) {
- targetElementCollector.add(((IConstraintStatus)status).getTarget());
- allConstraintStatuses.add(status);
- }
- if(status.isMultiStatus()) {
- IStatus[] children = status.getChildren();
- for(int i = 0; i < children.length; i++) {
- collectTargetElements(children[i], targetElementCollector, allConstraintStatuses);
- }
- }
- return targetElementCollector;
- }
-
- /**
- * @generated
- */
- private static void createMarkers(IFile target, Diagnostic emfValidationStatus, DiagramEditPart diagramEditPart) {
- if(emfValidationStatus.getSeverity() == Diagnostic.OK) {
- return;
- }
- final Diagnostic rootStatus = emfValidationStatus;
- List allDiagnostics = new ArrayList();
- UMLDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new UMLDiagramEditorUtil.LazyElement2ViewMap(diagramEditPart.getDiagramView(), collectTargetElements(rootStatus, new HashSet<EObject>(), allDiagnostics));
- for(Iterator it = emfValidationStatus.getChildren().iterator(); it.hasNext();) {
- Diagnostic nextDiagnostic = (Diagnostic)it.next();
- List data = nextDiagnostic.getData();
- if(data != null && !data.isEmpty() && data.get(0) instanceof EObject) {
- EObject element = (EObject)data.get(0);
- 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 createMarkers(IFile target, IStatus validationStatus, DiagramEditPart diagramEditPart) {
- if(validationStatus.isOK()) {
- return;
- }
- final IStatus rootStatus = validationStatus;
- List allStatuses = new ArrayList();
- UMLDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new UMLDiagramEditorUtil.LazyElement2ViewMap(diagramEditPart.getDiagramView(), collectTargetElements(rootStatus, new HashSet<EObject>(), allStatuses));
- for(Iterator it = allStatuses.iterator(); it.hasNext();) {
- IConstraintStatus nextStatus = (IConstraintStatus)it.next();
- 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 int diagnosticToStatusSeverity(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 Diagnostic runEMFValidator(View target) {
- if(target.isSetElement() && target.getElement() != null) {
- return new Diagnostician() {
-
- public String getObjectLabel(EObject eObject) {
- return EMFCoreUtil.getQualifiedName(eObject, true);
- }
- }.validate(target.getElement());
- }
- return Diagnostic.OK_INSTANCE;
- }
-
- /**
- * @generated
- */
- public static void runNonUIValidation(View view) {
- DiagramEditPart diagramEditPart = OffscreenEditPartFactory.getInstance().createDiagramEditPart(view.getDiagram());
- runValidation(diagramEditPart, view);
- }
-
- /**
- * @generated
- */
- public static void runValidation(DiagramEditPart diagramEditPart, View view) {
- final DiagramEditPart fpart = diagramEditPart;
- final View fview = view;
- TransactionalEditingDomain txDomain = TransactionUtil.getEditingDomain(view);
- UMLValidationProvider.runWithConstraints(txDomain, new Runnable() {
-
- public void run() {
- validate(fpart, fview);
- }
- });
- }
-
- /**
- * @generated
- */
- public static void runValidation(View view) {
- try {
- if(UMLDiagramEditorUtil.openDiagram(view.eResource())) {
- IEditorPart editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- if(editorPart instanceof IDiagramWorkbenchPart) {
- runValidation(((IDiagramWorkbenchPart)editorPart).getDiagramEditPart(), view);
- } else {
- runNonUIValidation(view);
- }
- }
- } catch (Exception e) {
- UMLDiagramEditorPlugin.getInstance().logError("Validation action failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private static void validate(DiagramEditPart diagramEditPart, View view) {
- IFile target = view.eResource() != null ? WorkspaceSynchronizer.getFile(view.eResource()) : null;
- if(target != null) {
- UMLMarkerNavigationProvider.deleteMarkers(target);
- }
- Diagnostic diagnostic = runEMFValidator(view);
- createMarkers(target, diagnostic, diagramEditPart);
- IBatchValidator validator = (IBatchValidator)ModelValidationService.getInstance().newValidator(EvaluationMode.BATCH);
- validator.setIncludeLiveConstraints(true);
- if(view.isSetElement() && view.getElement() != null) {
- IStatus status = validator.validate(view.getElement());
- createMarkers(target, status, diagramEditPart);
- }
- }
-
- /**
- * @generated
- */
- private IWorkbenchPage page;
-
- /**
- * @generated
- */
- public ValidateAction(IWorkbenchPage page) {
- setText(Messages.ValidateActionMessage);
- this.page = page;
- }
-
- /**
- * @generated
- */
- public void run() {
- IWorkbenchPart workbenchPart = page.getActivePart();
- if(workbenchPart instanceof IDiagramWorkbenchPart) {
- final IDiagramWorkbenchPart part = (IDiagramWorkbenchPart)workbenchPart;
- try {
- new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() {
-
- public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- runValidation(part.getDiagramEditPart(), part.getDiagram());
- }
- }).run(new NullProgressMonitor());
- } catch (Exception e) {
- UMLDiagramEditorPlugin.getInstance().logError("Validation action failed", e); //$NON-NLS-1$
- }
- }
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/ConnectionPointReferencePreferencePage.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/ConnectionPointReferencePreferencePage.java
deleted file mode 100644
index 8dd4211a2bd..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/ConnectionPointReferencePreferencePage.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.preferences;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.preferences.pages.AbstractPapyrusNodePreferencePage;
-import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
-
-/**
- * @generated
- */
-public class ConnectionPointReferencePreferencePage extends AbstractPapyrusNodePreferencePage {
-
- /**
- * @generated
- */
- public static void initDefaults(IPreferenceStore store) {
-
- String key = PackageEditPart.MODEL_ID + "_ConnectionPointReference";
- 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.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new org.eclipse.swt.graphics.RGB(255, 255, 255));
- //org.eclipse.jface.preference.PreferenceConverter.setDefault(store, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.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.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
- //org.eclipse.papyrus.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter = new org.eclipse.papyrus.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.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT), gradientPreferenceConverter.getPreferenceValue());
-
- }
-
- /**
- * @generated
- */
- public ConnectionPointReferencePreferencePage() {
- super();
- setPreferenceKey(PackageEditPart.MODEL_ID + "_ConnectionPointReference");
- }
-
- /**
- * @generated
- */
- @Override
- protected String getBundleId() {
- return UMLDiagramEditorPlugin.ID;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/DiagramAppearancePreferencePage.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/DiagramAppearancePreferencePage.java
deleted file mode 100644
index 6b4d34047ba..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/DiagramAppearancePreferencePage.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.preferences;
-
-import org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePreferencePage;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class DiagramAppearancePreferencePage extends AppearancePreferencePage {
-
- /**
- * @generated
- */
- public DiagramAppearancePreferencePage() {
- setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
-
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/DiagramConnectionsPreferencePage.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/DiagramConnectionsPreferencePage.java
deleted file mode 100644
index ee6f97fc080..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/DiagramConnectionsPreferencePage.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.preferences;
-
-import org.eclipse.gmf.runtime.diagram.ui.preferences.ConnectionsPreferencePage;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class DiagramConnectionsPreferencePage extends ConnectionsPreferencePage {
-
- /**
- * @generated
- */
- public DiagramConnectionsPreferencePage() {
- setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
-
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/DiagramGeneralPreferencePage.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/DiagramGeneralPreferencePage.java
deleted file mode 100644
index b14e4967ba4..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/DiagramGeneralPreferencePage.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.preferences;
-
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.preferences.pages.DiagramPreferencePage;
-
-/**
- * @generated
- */
-public class DiagramGeneralPreferencePage extends DiagramPreferencePage {
-
- /**
- * @generated
- */
- public DiagramGeneralPreferencePage() {
- setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
- setPreferenceKey(PackageEditPart.MODEL_ID);
-
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/DiagramPreferenceInitializer.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/DiagramPreferenceInitializer.java
deleted file mode 100644
index 622f983e87c..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/DiagramPreferenceInitializer.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.preferences;
-
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class DiagramPreferenceInitializer extends AbstractPreferenceInitializer {
-
- /**
- * @generated
- */
- protected IPreferenceStore getPreferenceStore() {
- return UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
- }
-
- /**
- * @generated
- */
- public void initializeDefaultPreferences() {
- IPreferenceStore store = getPreferenceStore();
-
- PseudostatePreferencePage.initDefaults(store);
-
- ConnectionPointReferencePreferencePage.initDefaults(store);
-
- RegionPreferencePage.initDefaults(store);
-
- StatePreferencePage.initDefaults(store);
-
- FinalStatePreferencePage.initDefaults(store);
-
- StateMachinePreferencePage.initDefaults(store);
-
- GeneralizationPreferencePage.initDefaults(store);
-
- TransitionPreferencePage.initDefaults(store);
-
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/DiagramPrintingPreferencePage.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/DiagramPrintingPreferencePage.java
deleted file mode 100644
index ed47a45c616..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/DiagramPrintingPreferencePage.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.preferences;
-
-import org.eclipse.gmf.runtime.diagram.ui.preferences.PrintingPreferencePage;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class DiagramPrintingPreferencePage extends PrintingPreferencePage {
-
- /**
- * @generated
- */
- public DiagramPrintingPreferencePage() {
- setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
-
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/DiagramRulersAndGridPreferencePage.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/DiagramRulersAndGridPreferencePage.java
deleted file mode 100644
index 3b897132d84..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/DiagramRulersAndGridPreferencePage.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.preferences;
-
-import org.eclipse.gmf.runtime.diagram.ui.preferences.RulerGridPreferencePage;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class DiagramRulersAndGridPreferencePage extends RulerGridPreferencePage {
-
- /**
- * @generated
- */
- public DiagramRulersAndGridPreferencePage() {
- setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
-
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/FinalStatePreferencePage.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/FinalStatePreferencePage.java
deleted file mode 100644
index 71bf70b0f68..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/FinalStatePreferencePage.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.preferences;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.preferences.pages.AbstractPapyrusNodePreferencePage;
-import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
-
-/**
- * @generated
- */
-public class FinalStatePreferencePage extends AbstractPapyrusNodePreferencePage {
-
- /**
- * @generated
- */
- public static void initDefaults(IPreferenceStore store) {
-
- String key = PackageEditPart.MODEL_ID + "_FinalState";
- store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 16);
- store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 16);
-
- //org.eclipse.jface.preference.PreferenceConverter.setDefault(store, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new org.eclipse.swt.graphics.RGB(255, 255, 255));
- //org.eclipse.jface.preference.PreferenceConverter.setDefault(store, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.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.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
- //org.eclipse.papyrus.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter = new org.eclipse.papyrus.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.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT), gradientPreferenceConverter.getPreferenceValue());
-
- }
-
- /**
- * @generated
- */
- public FinalStatePreferencePage() {
- super();
- setPreferenceKey(PackageEditPart.MODEL_ID + "_FinalState");
- }
-
- /**
- * @generated
- */
- @Override
- protected String getBundleId() {
- return UMLDiagramEditorPlugin.ID;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/GeneralizationPreferencePage.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/GeneralizationPreferencePage.java
deleted file mode 100644
index 0d423872aef..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/GeneralizationPreferencePage.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.preferences;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.preferences.pages.AbstractPapyrusLinkPreferencePage;
-
-/**
- * @generated
- */
-public class GeneralizationPreferencePage extends AbstractPapyrusLinkPreferencePage {
-
- /**
- * @generated
- */
- public static void initDefaults(IPreferenceStore store) {
-
- }
-
- /**
- * @generated
- */
- public GeneralizationPreferencePage() {
- super();
- setPreferenceKey(PackageEditPart.MODEL_ID + "_Generalization");
- }
-
- /**
- * @generated
- */
- @Override
- protected String getBundleId() {
- return UMLDiagramEditorPlugin.ID;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/PseudostatePreferencePage.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/PseudostatePreferencePage.java
deleted file mode 100644
index e695a77de29..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/PseudostatePreferencePage.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.preferences;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.preferences.pages.AbstractPapyrusNodePreferencePage;
-import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
-
-/**
- * @generated
- */
-public class PseudostatePreferencePage extends AbstractPapyrusNodePreferencePage {
-
- /**
- * @generated
- */
- public static void initDefaults(IPreferenceStore store) {
-
- String key = PackageEditPart.MODEL_ID + "_Pseudostate";
- 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.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new org.eclipse.swt.graphics.RGB(255, 255, 255));
- //org.eclipse.jface.preference.PreferenceConverter.setDefault(store, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.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.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
- //org.eclipse.papyrus.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter = new org.eclipse.papyrus.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.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT), gradientPreferenceConverter.getPreferenceValue());
-
- }
-
- /**
- * @generated
- */
- public PseudostatePreferencePage() {
- super();
- setPreferenceKey(PackageEditPart.MODEL_ID + "_Pseudostate");
- }
-
- /**
- * @generated
- */
- @Override
- protected String getBundleId() {
- return UMLDiagramEditorPlugin.ID;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/RegionPreferencePage.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/RegionPreferencePage.java
deleted file mode 100644
index fb9b562c31d..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/RegionPreferencePage.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.preferences;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.preferences.pages.AbstractPapyrusNodePreferencePage;
-import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
-
-/**
- * @generated
- */
-public class RegionPreferencePage extends AbstractPapyrusNodePreferencePage {
-
- /**
- * @generated
- */
- public static final String compartments[] = { "RegionCompartment" };
-
- /**
- * @generated
- */
- public static void initDefaults(IPreferenceStore store) {
-
- String key = PackageEditPart.MODEL_ID + "_Region";
- store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 40);
- store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 40);
-
- for(String name : compartments) {
- String preferenceName = PreferenceConstantHelper.getCompartmentElementConstant(key, name, PreferenceConstantHelper.COMPARTMENT_VISIBILITY);
- store.setDefault(preferenceName, true);
- }
-
- //org.eclipse.jface.preference.PreferenceConverter.setDefault(store, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new org.eclipse.swt.graphics.RGB(255, 255, 255));
- //org.eclipse.jface.preference.PreferenceConverter.setDefault(store, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.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.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
- //org.eclipse.papyrus.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter = new org.eclipse.papyrus.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.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT), gradientPreferenceConverter.getPreferenceValue());
-
- }
-
- /**
- * @generated
- */
- public RegionPreferencePage() {
- super();
- setPreferenceKey(PackageEditPart.MODEL_ID + "_Region");
- }
-
- /**
- * @generated
- */
- @Override
- protected String getBundleId() {
- return UMLDiagramEditorPlugin.ID;
- }
-
- /**
- * @generated
- */
- @Override
- protected void initializeCompartmentsList() {
- for(String name : compartments) {
- this.compartmentsList.add(name);
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/StateMachinePreferencePage.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/StateMachinePreferencePage.java
deleted file mode 100644
index 222f7c6014e..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/StateMachinePreferencePage.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.preferences;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.preferences.pages.AbstractPapyrusNodePreferencePage;
-import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
-
-/**
- * @generated
- */
-public class StateMachinePreferencePage extends AbstractPapyrusNodePreferencePage {
-
- /**
- * @generated
- */
- public static final String compartments[] = { "StateMachineCompartment" };
-
- /**
- * @generated
- */
- public static void initDefaults(IPreferenceStore store) {
-
- String key = PackageEditPart.MODEL_ID + "_StateMachine";
- store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 200);
- store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 100);
-
- for(String name : compartments) {
- String preferenceName = PreferenceConstantHelper.getCompartmentElementConstant(key, name, PreferenceConstantHelper.COMPARTMENT_VISIBILITY);
- store.setDefault(preferenceName, true);
- }
-
- //org.eclipse.jface.preference.PreferenceConverter.setDefault(store, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new org.eclipse.swt.graphics.RGB(255, 255, 255));
- //org.eclipse.jface.preference.PreferenceConverter.setDefault(store, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.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.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
- //org.eclipse.papyrus.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter = new org.eclipse.papyrus.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.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT), gradientPreferenceConverter.getPreferenceValue());
-
- }
-
- /**
- * @generated
- */
- public StateMachinePreferencePage() {
- super();
- setPreferenceKey(PackageEditPart.MODEL_ID + "_StateMachine");
- }
-
- /**
- * @generated
- */
- @Override
- protected String getBundleId() {
- return UMLDiagramEditorPlugin.ID;
- }
-
- /**
- * @generated
- */
- @Override
- protected void initializeCompartmentsList() {
- for(String name : compartments) {
- this.compartmentsList.add(name);
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/StatePreferencePage.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/StatePreferencePage.java
deleted file mode 100644
index c13b17c8707..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/StatePreferencePage.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.preferences;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.preferences.pages.AbstractPapyrusNodePreferencePage;
-import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
-
-/**
- * @generated
- */
-public class StatePreferencePage extends AbstractPapyrusNodePreferencePage {
-
- /**
- * @generated
- */
- public static final String compartments[] = { "StateCompartment" };
-
- /**
- * @generated
- */
- public static void initDefaults(IPreferenceStore store) {
-
- String key = PackageEditPart.MODEL_ID + "_State";
- store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 40);
- store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 40);
-
- for(String name : compartments) {
- String preferenceName = PreferenceConstantHelper.getCompartmentElementConstant(key, name, PreferenceConstantHelper.COMPARTMENT_VISIBILITY);
- store.setDefault(preferenceName, true);
- }
-
- //org.eclipse.jface.preference.PreferenceConverter.setDefault(store, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new org.eclipse.swt.graphics.RGB(255, 255, 255));
- //org.eclipse.jface.preference.PreferenceConverter.setDefault(store, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.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.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false);
- //org.eclipse.papyrus.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter = new org.eclipse.papyrus.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.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT), gradientPreferenceConverter.getPreferenceValue());
-
- }
-
- /**
- * @generated
- */
- public StatePreferencePage() {
- super();
- setPreferenceKey(PackageEditPart.MODEL_ID + "_State");
- }
-
- /**
- * @generated
- */
- @Override
- protected String getBundleId() {
- return UMLDiagramEditorPlugin.ID;
- }
-
- /**
- * @generated
- */
- @Override
- protected void initializeCompartmentsList() {
- for(String name : compartments) {
- this.compartmentsList.add(name);
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/TransitionPreferencePage.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/TransitionPreferencePage.java
deleted file mode 100644
index 7856f52de34..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/preferences/TransitionPreferencePage.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.preferences;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.preferences.pages.AbstractPapyrusLinkPreferencePage;
-
-/**
- * @generated
- */
-public class TransitionPreferencePage extends AbstractPapyrusLinkPreferencePage {
-
- /**
- * @generated
- */
- public static void initDefaults(IPreferenceStore store) {
-
- }
-
- /**
- * @generated
- */
- public TransitionPreferencePage() {
- super();
- setPreferenceKey(PackageEditPart.MODEL_ID + "_Transition");
- }
-
- /**
- * @generated
- */
- @Override
- protected String getBundleId() {
- return UMLDiagramEditorPlugin.ID;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/ElementInitializers.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/ElementInitializers.java
deleted file mode 100644
index b009361085d..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/ElementInitializers.java
+++ /dev/null
@@ -1,971 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.providers;
-
-import java.util.Iterator;
-
-import org.eclipse.papyrus.diagram.common.helper.NamedElementHelper;
-import org.eclipse.papyrus.diagram.statemachine.custom.expressions.UMLAbstractExpression;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.uml2.uml.ConnectionPointReference;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.FinalState;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Pseudostate;
-import org.eclipse.uml2.uml.PseudostateKind;
-import org.eclipse.uml2.uml.Region;
-import org.eclipse.uml2.uml.State;
-import org.eclipse.uml2.uml.StateMachine;
-import org.eclipse.uml2.uml.Transition;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ElementInitializers {
-
- /**
- * @generated
- */
- public static ElementInitializers getInstance() {
- ElementInitializers cached = UMLDiagramEditorPlugin.getInstance().getElementInitializers();
- if(cached == null) {
- UMLDiagramEditorPlugin.getInstance().setElementInitializers(cached = new ElementInitializers());
- }
- return cached;
- }
-
- /**
- * Custom code
- *
- * @param self
- * @return
- */
- private static String getName(org.eclipse.uml2.uml.Element self) {
- return NamedElementHelper.EINSTANCE.getNewUMLElementName(self.getOwner(), self.eClass());
-
- }
-
- protected ElementInitializers() {
- // use #getInstance to access cached instance
- }
-
- /**
- * @generated
- */
- public void init_ConnectionPointReference_18000(ConnectionPointReference instance) {
- try {
- Object value_0 = name_ConnectionPointReference_18000(instance);
- instance.setName((java.lang.String)value_0);
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_FinalState_5000(FinalState instance) {
- try {
- Object value_0 = name_FinalState_5000(instance);
- instance.setName((java.lang.String)value_0);
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Pseudostate_10000(Pseudostate instance) {
- try {
- Object value_0 = kind_Pseudostate_10000(instance);
-
- value_0 = UMLAbstractExpression.performCast(value_0, UMLPackage.eINSTANCE.getPseudostateKind());
- instance.setKind((PseudostateKind)value_0);
- Object value_1 = name_Pseudostate_10000(instance);
- instance.setName((java.lang.String)value_1);
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Pseudostate_11000(Pseudostate instance) {
- try {
- Object value_0 = kind_Pseudostate_11000(instance);
-
- value_0 = UMLAbstractExpression.performCast(value_0, UMLPackage.eINSTANCE.getPseudostateKind());
- instance.setKind((PseudostateKind)value_0);
- Object value_1 = name_Pseudostate_11000(instance);
- instance.setName((java.lang.String)value_1);
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Pseudostate_12000(Pseudostate instance) {
- try {
- Object value_0 = kind_Pseudostate_12000(instance);
-
- value_0 = UMLAbstractExpression.performCast(value_0, UMLPackage.eINSTANCE.getPseudostateKind());
- instance.setKind((PseudostateKind)value_0);
- Object value_1 = name_Pseudostate_12000(instance);
- instance.setName((java.lang.String)value_1);
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Pseudostate_13000(Pseudostate instance) {
- try {
- Object value_0 = kind_Pseudostate_13000(instance);
-
- value_0 = UMLAbstractExpression.performCast(value_0, UMLPackage.eINSTANCE.getPseudostateKind());
- instance.setKind((PseudostateKind)value_0);
- Object value_1 = name_Pseudostate_13000(instance);
- instance.setName((java.lang.String)value_1);
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Pseudostate_14000(Pseudostate instance) {
- try {
- Object value_0 = kind_Pseudostate_14000(instance);
-
- value_0 = UMLAbstractExpression.performCast(value_0, UMLPackage.eINSTANCE.getPseudostateKind());
- instance.setKind((PseudostateKind)value_0);
- Object value_1 = name_Pseudostate_14000(instance);
- instance.setName((java.lang.String)value_1);
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Pseudostate_15000(Pseudostate instance) {
- try {
- Object value_0 = kind_Pseudostate_15000(instance);
-
- value_0 = UMLAbstractExpression.performCast(value_0, UMLPackage.eINSTANCE.getPseudostateKind());
- instance.setKind((PseudostateKind)value_0);
- Object value_1 = name_Pseudostate_15000(instance);
- instance.setName((java.lang.String)value_1);
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Pseudostate_16000(Pseudostate instance) {
- try {
- Object value_0 = kind_Pseudostate_16000(instance);
-
- value_0 = UMLAbstractExpression.performCast(value_0, UMLPackage.eINSTANCE.getPseudostateKind());
- instance.setKind((PseudostateKind)value_0);
- Object value_1 = name_Pseudostate_16000(instance);
- instance.setName((java.lang.String)value_1);
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Pseudostate_17000(Pseudostate instance) {
- try {
- Object value_0 = kind_Pseudostate_17000(instance);
-
- value_0 = UMLAbstractExpression.performCast(value_0, UMLPackage.eINSTANCE.getPseudostateKind());
- instance.setKind((PseudostateKind)value_0);
- Object value_1 = name_Pseudostate_17000(instance);
- instance.setName((java.lang.String)value_1);
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Pseudostate_8000(Pseudostate instance) {
- try {
- Object value_0 = kind_Pseudostate_8000(instance);
-
- value_0 = UMLAbstractExpression.performCast(value_0, UMLPackage.eINSTANCE.getPseudostateKind());
- instance.setKind((PseudostateKind)value_0);
- Object value_1 = name_Pseudostate_8000(instance);
- instance.setName((java.lang.String)value_1);
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Pseudostate_9000(Pseudostate instance) {
- try {
- Object value_0 = kind_Pseudostate_9000(instance);
-
- value_0 = UMLAbstractExpression.performCast(value_0, UMLPackage.eINSTANCE.getPseudostateKind());
- instance.setKind((PseudostateKind)value_0);
- Object value_1 = name_Pseudostate_9000(instance);
- instance.setName((java.lang.String)value_1);
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Region_3000(Region instance) {
- try {
- Object value_0 = name_Region_3000(instance);
- instance.setName((java.lang.String)value_0);
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_State_6000(State instance) {
- try {
- Object value_0 = name_State_6000(instance);
- instance.setName((java.lang.String)value_0);
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_StateMachine_2000(StateMachine instance) {
- try {
- Object value_0 = name_StateMachine_2000(instance);
- instance.setName((java.lang.String)value_0);
- Region newInstance_1_0 = UMLFactory.eINSTANCE.createRegion();
- instance.getRegions().add(newInstance_1_0);
- Object value_1_0_0 = name_region_StateMachine_2000(newInstance_1_0);
- newInstance_1_0.setName((java.lang.String)value_1_0_0);
-
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Transition_7000(Transition instance) {
- try {
- Object value_0 = name_Transition_7000(instance);
- instance.setName((java.lang.String)value_0);
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private PseudostateKind kind_Pseudostate_10000(Pseudostate self) {
- return PseudostateKind.FORK_LITERAL;
- }
-
- /**
- * @generated
- */
- private PseudostateKind kind_Pseudostate_11000(Pseudostate self) {
- return PseudostateKind.CHOICE_LITERAL;
- }
-
- /**
- * @generated
- */
- private PseudostateKind kind_Pseudostate_12000(Pseudostate self) {
- return PseudostateKind.JUNCTION_LITERAL;
- }
-
- /**
- * @generated
- */
- private PseudostateKind kind_Pseudostate_13000(Pseudostate self) {
- return PseudostateKind.SHALLOW_HISTORY_LITERAL;
- }
-
- /**
- * @generated
- */
- private PseudostateKind kind_Pseudostate_14000(Pseudostate self) {
- return PseudostateKind.DEEP_HISTORY_LITERAL;
- }
-
- /**
- * @generated
- */
- private PseudostateKind kind_Pseudostate_15000(Pseudostate self) {
- return PseudostateKind.TERMINATE_LITERAL;
- }
-
- /**
- * @generated
- */
- private PseudostateKind kind_Pseudostate_16000(Pseudostate self) {
- return PseudostateKind.ENTRY_POINT_LITERAL;
- }
-
- /**
- * @generated
- */
- private PseudostateKind kind_Pseudostate_17000(Pseudostate self) {
- return PseudostateKind.EXIT_POINT_LITERAL;
- }
-
- /**
- * @generated
- */
- private PseudostateKind kind_Pseudostate_8000(Pseudostate self) {
- return PseudostateKind.INITIAL_LITERAL;
- }
-
- /**
- * @generated
- */
- private PseudostateKind kind_Pseudostate_9000(Pseudostate self) {
- return PseudostateKind.JOIN_LITERAL;
- }
-
- /**
- * @generated
- */
- private java.lang.String name_ConnectionPointReference_18000(ConnectionPointReference self) {
- //provides a new name taking into account the pseudostatekind if any
- String baseString = self.eClass().getName();
- if(self instanceof Pseudostate) {
- baseString = ((Pseudostate)self).getKind().getLiteral();
- baseString = baseString.substring(0, 1).toUpperCase() + baseString.substring(1);
- }
- String name = ""; //$NON-NLS-1$
-
- Element umlParent = self.getOwner();
-
- boolean found = false;
- // i <10000: avoid infinite loops
- for(int i = 0; i < 10001; i++) {
- found = false;
- name = baseString + i;
- Iterator it = umlParent.getOwnedElements().iterator();
- while(it.hasNext() && !found) {
- Object o = it.next();
- if(o instanceof NamedElement) {
- if(name.equals(((NamedElement)o).getName())) {
- found = true;
- }
- }
- }
- if(!found) {
- return name;
- }
- }
- return baseString + "X"; //$NON-NLS-1$
-
- }
-
- /**
- * @generated
- */
- private java.lang.String name_FinalState_5000(FinalState self) {
- //provides a new name taking into account the pseudostatekind if any
- String baseString = self.eClass().getName();
- if(self instanceof Pseudostate) {
- baseString = ((Pseudostate)self).getKind().getLiteral();
- baseString = baseString.substring(0, 1).toUpperCase() + baseString.substring(1);
- }
- String name = ""; //$NON-NLS-1$
-
- Element umlParent = self.getOwner();
-
- boolean found = false;
- // i <10000: avoid infinite loops
- for(int i = 0; i < 10001; i++) {
- found = false;
- name = baseString + i;
- Iterator it = umlParent.getOwnedElements().iterator();
- while(it.hasNext() && !found) {
- Object o = it.next();
- if(o instanceof NamedElement) {
- if(name.equals(((NamedElement)o).getName())) {
- found = true;
- }
- }
- }
- if(!found) {
- return name;
- }
- }
- return baseString + "X"; //$NON-NLS-1$
-
- }
-
- /**
- * @generated
- */
- private java.lang.String name_Pseudostate_10000(Pseudostate self) {
- //provides a new name taking into account the pseudostatekind if any
- String baseString = self.eClass().getName();
- if(self instanceof Pseudostate) {
- baseString = ((Pseudostate)self).getKind().getLiteral();
- baseString = baseString.substring(0, 1).toUpperCase() + baseString.substring(1);
- }
- String name = ""; //$NON-NLS-1$
-
- Element umlParent = self.getOwner();
-
- boolean found = false;
- // i <10000: avoid infinite loops
- for(int i = 0; i < 10001; i++) {
- found = false;
- name = baseString + i;
- Iterator it = umlParent.getOwnedElements().iterator();
- while(it.hasNext() && !found) {
- Object o = it.next();
- if(o instanceof NamedElement) {
- if(name.equals(((NamedElement)o).getName())) {
- found = true;
- }
- }
- }
- if(!found) {
- return name;
- }
- }
- return baseString + "X"; //$NON-NLS-1$
-
- }
-
- /**
- * @generated
- */
- private java.lang.String name_Pseudostate_11000(Pseudostate self) {
- //provides a new name taking into account the pseudostatekind if any
- String baseString = self.eClass().getName();
- if(self instanceof Pseudostate) {
- baseString = ((Pseudostate)self).getKind().getLiteral();
- baseString = baseString.substring(0, 1).toUpperCase() + baseString.substring(1);
- }
- String name = ""; //$NON-NLS-1$
-
- Element umlParent = self.getOwner();
-
- boolean found = false;
- // i <10000: avoid infinite loops
- for(int i = 0; i < 10001; i++) {
- found = false;
- name = baseString + i;
- Iterator it = umlParent.getOwnedElements().iterator();
- while(it.hasNext() && !found) {
- Object o = it.next();
- if(o instanceof NamedElement) {
- if(name.equals(((NamedElement)o).getName())) {
- found = true;
- }
- }
- }
- if(!found) {
- return name;
- }
- }
- return baseString + "X"; //$NON-NLS-1$
-
- }
-
- /**
- * @generated
- */
- private java.lang.String name_Pseudostate_12000(Pseudostate self) {
- //provides a new name taking into account the pseudostatekind if any
- String baseString = self.eClass().getName();
- if(self instanceof Pseudostate) {
- baseString = ((Pseudostate)self).getKind().getLiteral();
- baseString = baseString.substring(0, 1).toUpperCase() + baseString.substring(1);
- }
- String name = ""; //$NON-NLS-1$
-
- Element umlParent = self.getOwner();
-
- boolean found = false;
- // i <10000: avoid infinite loops
- for(int i = 0; i < 10001; i++) {
- found = false;
- name = baseString + i;
- Iterator it = umlParent.getOwnedElements().iterator();
- while(it.hasNext() && !found) {
- Object o = it.next();
- if(o instanceof NamedElement) {
- if(name.equals(((NamedElement)o).getName())) {
- found = true;
- }
- }
- }
- if(!found) {
- return name;
- }
- }
- return baseString + "X"; //$NON-NLS-1$
-
- }
-
- /**
- * @generated
- */
- private java.lang.String name_Pseudostate_13000(Pseudostate self) {
- //provides a new name taking into account the pseudostatekind if any
- String baseString = self.eClass().getName();
- if(self instanceof Pseudostate) {
- baseString = ((Pseudostate)self).getKind().getLiteral();
- baseString = baseString.substring(0, 1).toUpperCase() + baseString.substring(1);
- }
- String name = ""; //$NON-NLS-1$
-
- Element umlParent = self.getOwner();
-
- boolean found = false;
- // i <10000: avoid infinite loops
- for(int i = 0; i < 10001; i++) {
- found = false;
- name = baseString + i;
- Iterator it = umlParent.getOwnedElements().iterator();
- while(it.hasNext() && !found) {
- Object o = it.next();
- if(o instanceof NamedElement) {
- if(name.equals(((NamedElement)o).getName())) {
- found = true;
- }
- }
- }
- if(!found) {
- return name;
- }
- }
- return baseString + "X"; //$NON-NLS-1$
-
- }
-
- /**
- * @generated
- */
- private java.lang.String name_Pseudostate_14000(Pseudostate self) {
- //provides a new name taking into account the pseudostatekind if any
- String baseString = self.eClass().getName();
- if(self instanceof Pseudostate) {
- baseString = ((Pseudostate)self).getKind().getLiteral();
- baseString = baseString.substring(0, 1).toUpperCase() + baseString.substring(1);
- }
- String name = ""; //$NON-NLS-1$
-
- Element umlParent = self.getOwner();
-
- boolean found = false;
- // i <10000: avoid infinite loops
- for(int i = 0; i < 10001; i++) {
- found = false;
- name = baseString + i;
- Iterator it = umlParent.getOwnedElements().iterator();
- while(it.hasNext() && !found) {
- Object o = it.next();
- if(o instanceof NamedElement) {
- if(name.equals(((NamedElement)o).getName())) {
- found = true;
- }
- }
- }
- if(!found) {
- return name;
- }
- }
- return baseString + "X"; //$NON-NLS-1$
-
- }
-
- /**
- * @generated
- */
- private java.lang.String name_Pseudostate_15000(Pseudostate self) {
- //provides a new name taking into account the pseudostatekind if any
- String baseString = self.eClass().getName();
- if(self instanceof Pseudostate) {
- baseString = ((Pseudostate)self).getKind().getLiteral();
- baseString = baseString.substring(0, 1).toUpperCase() + baseString.substring(1);
- }
- String name = ""; //$NON-NLS-1$
-
- Element umlParent = self.getOwner();
-
- boolean found = false;
- // i <10000: avoid infinite loops
- for(int i = 0; i < 10001; i++) {
- found = false;
- name = baseString + i;
- Iterator it = umlParent.getOwnedElements().iterator();
- while(it.hasNext() && !found) {
- Object o = it.next();
- if(o instanceof NamedElement) {
- if(name.equals(((NamedElement)o).getName())) {
- found = true;
- }
- }
- }
- if(!found) {
- return name;
- }
- }
- return baseString + "X"; //$NON-NLS-1$
-
- }
-
- /**
- * @generated
- */
- private java.lang.String name_Pseudostate_16000(Pseudostate self) {
- //provides a new name taking into account the pseudostatekind if any
- String baseString = self.eClass().getName();
- if(self instanceof Pseudostate) {
- baseString = ((Pseudostate)self).getKind().getLiteral();
- baseString = baseString.substring(0, 1).toUpperCase() + baseString.substring(1);
- }
- String name = ""; //$NON-NLS-1$
-
- Element umlParent = self.getOwner();
-
- boolean found = false;
- // i <10000: avoid infinite loops
- for(int i = 0; i < 10001; i++) {
- found = false;
- name = baseString + i;
- Iterator it = umlParent.getOwnedElements().iterator();
- while(it.hasNext() && !found) {
- Object o = it.next();
- if(o instanceof NamedElement) {
- if(name.equals(((NamedElement)o).getName())) {
- found = true;
- }
- }
- }
- if(!found) {
- return name;
- }
- }
- return baseString + "X"; //$NON-NLS-1$
-
- }
-
- /**
- * @generated
- */
- private java.lang.String name_Pseudostate_17000(Pseudostate self) {
- //provides a new name taking into account the pseudostatekind if any
- String baseString = self.eClass().getName();
- if(self instanceof Pseudostate) {
- baseString = ((Pseudostate)self).getKind().getLiteral();
- baseString = baseString.substring(0, 1).toUpperCase() + baseString.substring(1);
- }
- String name = ""; //$NON-NLS-1$
-
- Element umlParent = self.getOwner();
-
- boolean found = false;
- // i <10000: avoid infinite loops
- for(int i = 0; i < 10001; i++) {
- found = false;
- name = baseString + i;
- Iterator it = umlParent.getOwnedElements().iterator();
- while(it.hasNext() && !found) {
- Object o = it.next();
- if(o instanceof NamedElement) {
- if(name.equals(((NamedElement)o).getName())) {
- found = true;
- }
- }
- }
- if(!found) {
- return name;
- }
- }
- return baseString + "X"; //$NON-NLS-1$
-
- }
-
- /**
- * @generated
- */
- private java.lang.String name_Pseudostate_8000(Pseudostate self) {
- //provides a new name taking into account the pseudostatekind if any
- String baseString = self.eClass().getName();
- if(self instanceof Pseudostate) {
- baseString = ((Pseudostate)self).getKind().getLiteral();
- baseString = baseString.substring(0, 1).toUpperCase() + baseString.substring(1);
- }
- String name = ""; //$NON-NLS-1$
-
- Element umlParent = self.getOwner();
-
- boolean found = false;
- // i <10000: avoid infinite loops
- for(int i = 0; i < 10001; i++) {
- found = false;
- name = baseString + i;
- Iterator it = umlParent.getOwnedElements().iterator();
- while(it.hasNext() && !found) {
- Object o = it.next();
- if(o instanceof NamedElement) {
- if(name.equals(((NamedElement)o).getName())) {
- found = true;
- }
- }
- }
- if(!found) {
- return name;
- }
- }
- return baseString + "X"; //$NON-NLS-1$
-
- }
-
- /**
- * @generated
- */
- private java.lang.String name_Pseudostate_9000(Pseudostate self) {
- //provides a new name taking into account the pseudostatekind if any
- String baseString = self.eClass().getName();
- if(self instanceof Pseudostate) {
- baseString = ((Pseudostate)self).getKind().getLiteral();
- baseString = baseString.substring(0, 1).toUpperCase() + baseString.substring(1);
- }
- String name = ""; //$NON-NLS-1$
-
- Element umlParent = self.getOwner();
-
- boolean found = false;
- // i <10000: avoid infinite loops
- for(int i = 0; i < 10001; i++) {
- found = false;
- name = baseString + i;
- Iterator it = umlParent.getOwnedElements().iterator();
- while(it.hasNext() && !found) {
- Object o = it.next();
- if(o instanceof NamedElement) {
- if(name.equals(((NamedElement)o).getName())) {
- found = true;
- }
- }
- }
- if(!found) {
- return name;
- }
- }
- return baseString + "X"; //$NON-NLS-1$
-
- }
-
- /**
- * @generated
- */
- private java.lang.String name_Region_3000(Region self) {
- //provides a new name taking into account the pseudostatekind if any
- String baseString = self.eClass().getName();
- if(self instanceof Pseudostate) {
- baseString = ((Pseudostate)self).getKind().getLiteral();
- baseString = baseString.substring(0, 1).toUpperCase() + baseString.substring(1);
- }
- String name = ""; //$NON-NLS-1$
-
- Element umlParent = self.getOwner();
-
- boolean found = false;
- // i <10000: avoid infinite loops
- for(int i = 0; i < 10001; i++) {
- found = false;
- name = baseString + i;
- Iterator it = umlParent.getOwnedElements().iterator();
- while(it.hasNext() && !found) {
- Object o = it.next();
- if(o instanceof NamedElement) {
- if(name.equals(((NamedElement)o).getName())) {
- found = true;
- }
- }
- }
- if(!found) {
- return name;
- }
- }
- return baseString + "X"; //$NON-NLS-1$
-
- }
-
- /**
- * @generated
- */
- private java.lang.String name_region_StateMachine_2000(Region self) {
- //provides a new name taking into account the pseudostatekind if any
- String baseString = self.eClass().getName();
- if(self instanceof Pseudostate) {
- baseString = ((Pseudostate)self).getKind().getLiteral();
- baseString = baseString.substring(0, 1).toUpperCase() + baseString.substring(1);
- }
- String name = ""; //$NON-NLS-1$
-
- Element umlParent = self.getOwner();
-
- boolean found = false;
- // i <10000: avoid infinite loops
- for(int i = 0; i < 10001; i++) {
- found = false;
- name = baseString + i;
- Iterator it = umlParent.getOwnedElements().iterator();
- while(it.hasNext() && !found) {
- Object o = it.next();
- if(o instanceof NamedElement) {
- if(name.equals(((NamedElement)o).getName())) {
- found = true;
- }
- }
- }
- if(!found) {
- return name;
- }
- }
- return baseString + "X"; //$NON-NLS-1$
-
- }
-
- /**
- * @generated
- */
- private java.lang.String name_State_6000(State self) {
- //provides a new name taking into account the pseudostatekind if any
- String baseString = self.eClass().getName();
- if(self instanceof Pseudostate) {
- baseString = ((Pseudostate)self).getKind().getLiteral();
- baseString = baseString.substring(0, 1).toUpperCase() + baseString.substring(1);
- }
- String name = ""; //$NON-NLS-1$
-
- Element umlParent = self.getOwner();
-
- boolean found = false;
- // i <10000: avoid infinite loops
- for(int i = 0; i < 10001; i++) {
- found = false;
- name = baseString + i;
- Iterator it = umlParent.getOwnedElements().iterator();
- while(it.hasNext() && !found) {
- Object o = it.next();
- if(o instanceof NamedElement) {
- if(name.equals(((NamedElement)o).getName())) {
- found = true;
- }
- }
- }
- if(!found) {
- return name;
- }
- }
- return baseString + "X"; //$NON-NLS-1$
-
- }
-
- /**
- * @generated
- */
- private java.lang.String name_StateMachine_2000(StateMachine self) {
- //provides a new name taking into account the pseudostatekind if any
- String baseString = self.eClass().getName();
- if(self instanceof Pseudostate) {
- baseString = ((Pseudostate)self).getKind().getLiteral();
- baseString = baseString.substring(0, 1).toUpperCase() + baseString.substring(1);
- }
- String name = ""; //$NON-NLS-1$
-
- Element umlParent = self.getOwner();
-
- boolean found = false;
- // i <10000: avoid infinite loops
- for(int i = 0; i < 10001; i++) {
- found = false;
- name = baseString + i;
- Iterator it = umlParent.getOwnedElements().iterator();
- while(it.hasNext() && !found) {
- Object o = it.next();
- if(o instanceof NamedElement) {
- if(name.equals(((NamedElement)o).getName())) {
- found = true;
- }
- }
- }
- if(!found) {
- return name;
- }
- }
- return baseString + "X"; //$NON-NLS-1$
-
- }
-
- /**
- * @generated
- */
- private java.lang.String name_Transition_7000(Transition self) {
- //provides a new name taking into account the pseudostatekind if any
- String baseString = self.eClass().getName();
- if(self instanceof Pseudostate) {
- baseString = ((Pseudostate)self).getKind().getLiteral();
- baseString = baseString.substring(0, 1).toUpperCase() + baseString.substring(1);
- }
- String name = ""; //$NON-NLS-1$
-
- Element umlParent = self.getOwner();
-
- boolean found = false;
- // i <10000: avoid infinite loops
- for(int i = 0; i < 10001; i++) {
- found = false;
- name = baseString + i;
- Iterator it = umlParent.getOwnedElements().iterator();
- while(it.hasNext() && !found) {
- Object o = it.next();
- if(o instanceof NamedElement) {
- if(name.equals(((NamedElement)o).getName())) {
- found = true;
- }
- }
- }
- if(!found) {
- return name;
- }
- }
- return baseString + "X"; //$NON-NLS-1$
-
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLEditPartProvider.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLEditPartProvider.java
deleted file mode 100644
index 24f22efb3dc..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLEditPartProvider.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.UMLEditPartFactory;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-
-/**
- * @generated
- */
-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
- */
- protected IGraphicalEditPart createEditPart(View view) {
- EditPart part = factory.createEditPart(null, view);
- if(part instanceof IGraphicalEditPart) {
- return (IGraphicalEditPart)part;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public synchronized IGraphicalEditPart createGraphicEditPart(View view) {
- if(isAllowCaching()) {
- IGraphicalEditPart part = getCachedPart(view);
- cachedPart = null;
- cachedView = null;
- if(part != null) {
- return part;
- }
- }
- return createEditPart(view);
- }
-
- /**
- * @generated
- */
- protected IGraphicalEditPart getCachedPart(View view) {
- if(cachedView != null && cachedView.get() == view) {
- return (IGraphicalEditPart)cachedPart.get();
- }
- return null;
- }
-
- /**
- * @generated
- */
- public final EditPartFactory getFactory() {
- return factory;
- }
-
- /**
- * @generated
- */
- public final boolean isAllowCaching() {
- return allowCaching;
- }
-
- /**
- * @generated
- */
- public synchronized boolean provides(IOperation operation) {
- if(operation instanceof CreateGraphicEditPartOperation) {
- View view = ((IEditPartOperation)operation).getView();
- if(!PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view))) {
- return false;
- }
- if(isAllowCaching() && getCachedPart(view) != null) {
- return true;
- }
- IGraphicalEditPart part = createEditPart(view);
- if(part != null) {
- if(isAllowCaching()) {
- cachedPart = new WeakReference(part);
- cachedView = new WeakReference(view);
- }
- return true;
- }
- }
- return false;
- }
-
- /**
- * @generated
- */
- protected synchronized void setAllowCaching(boolean allowCaching) {
- this.allowCaching = allowCaching;
- if(!allowCaching) {
- cachedPart = null;
- cachedView = null;
- }
- }
-
- /**
- * @generated
- */
- protected void setFactory(EditPartFactory factory) {
- this.factory = factory;
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLElementTypes.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLElementTypes.java
deleted file mode 100644
index 044fe66a996..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLElementTypes.java
+++ /dev/null
@@ -1,380 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.diagram.statemachine.edit.parts.ConnectionPointReferenceEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.FinalStateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateChoiceEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateDeepHistoryEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateForkEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateInitialEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJoinEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJunctionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateShallowHistoryEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateTerminateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class 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_1000 = getElementType("org.eclipse.papyrus.diagram.statemachine.Package_1000"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType StateMachine_2000 = getElementType("org.eclipse.papyrus.diagram.statemachine.StateMachine_2000"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Region_3000 = getElementType("org.eclipse.papyrus.diagram.statemachine.Region_3000"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType FinalState_5000 = getElementType("org.eclipse.papyrus.diagram.statemachine.FinalState_5000"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType State_6000 = getElementType("org.eclipse.papyrus.diagram.statemachine.State_6000"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Pseudostate_8000 = getElementType("org.eclipse.papyrus.diagram.statemachine.Pseudostate_8000"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Pseudostate_9000 = getElementType("org.eclipse.papyrus.diagram.statemachine.Pseudostate_9000"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Pseudostate_10000 = getElementType("org.eclipse.papyrus.diagram.statemachine.Pseudostate_10000"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Pseudostate_11000 = getElementType("org.eclipse.papyrus.diagram.statemachine.Pseudostate_11000"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Pseudostate_12000 = getElementType("org.eclipse.papyrus.diagram.statemachine.Pseudostate_12000"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Pseudostate_13000 = getElementType("org.eclipse.papyrus.diagram.statemachine.Pseudostate_13000"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Pseudostate_14000 = getElementType("org.eclipse.papyrus.diagram.statemachine.Pseudostate_14000"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Pseudostate_15000 = getElementType("org.eclipse.papyrus.diagram.statemachine.Pseudostate_15000"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Pseudostate_16000 = getElementType("org.eclipse.papyrus.diagram.statemachine.Pseudostate_16000"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Pseudostate_17000 = getElementType("org.eclipse.papyrus.diagram.statemachine.Pseudostate_17000"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType ConnectionPointReference_18000 = getElementType("org.eclipse.papyrus.diagram.statemachine.ConnectionPointReference_18000"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Transition_7000 = getElementType("org.eclipse.papyrus.diagram.statemachine.Transition_7000"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Generalization_19000 = getElementType("org.eclipse.papyrus.diagram.statemachine.Generalization_19000"); //$NON-NLS-1$
-
- /**
- * Returns 'type' of the ecore object associated with the hint.
- *
- * @generated
- */
- public static ENamedElement getElement(IAdaptable hint) {
- Object type = hint.getAdapter(IElementType.class);
- if(elements == null) {
- elements = new IdentityHashMap<IElementType, ENamedElement>();
-
- elements.put(Package_1000, UMLPackage.eINSTANCE.getPackage());
-
- elements.put(StateMachine_2000, UMLPackage.eINSTANCE.getStateMachine());
-
- elements.put(Region_3000, UMLPackage.eINSTANCE.getRegion());
-
- elements.put(FinalState_5000, UMLPackage.eINSTANCE.getFinalState());
-
- elements.put(State_6000, UMLPackage.eINSTANCE.getState());
-
- elements.put(Pseudostate_8000, UMLPackage.eINSTANCE.getPseudostate());
-
- elements.put(Pseudostate_9000, UMLPackage.eINSTANCE.getPseudostate());
-
- elements.put(Pseudostate_10000, UMLPackage.eINSTANCE.getPseudostate());
-
- elements.put(Pseudostate_11000, UMLPackage.eINSTANCE.getPseudostate());
-
- elements.put(Pseudostate_12000, UMLPackage.eINSTANCE.getPseudostate());
-
- elements.put(Pseudostate_13000, UMLPackage.eINSTANCE.getPseudostate());
-
- elements.put(Pseudostate_14000, UMLPackage.eINSTANCE.getPseudostate());
-
- elements.put(Pseudostate_15000, UMLPackage.eINSTANCE.getPseudostate());
-
- elements.put(Pseudostate_16000, UMLPackage.eINSTANCE.getPseudostate());
-
- elements.put(Pseudostate_17000, UMLPackage.eINSTANCE.getPseudostate());
-
- elements.put(ConnectionPointReference_18000, UMLPackage.eINSTANCE.getConnectionPointReference());
-
- elements.put(Transition_7000, UMLPackage.eINSTANCE.getTransition());
-
- elements.put(Generalization_19000, UMLPackage.eINSTANCE.getGeneralization());
- }
- return (ENamedElement)elements.get(type);
- }
-
- /**
- * @generated
- */
- public static IElementType getElementType(int visualID) {
- switch(visualID) {
- case PackageEditPart.VISUAL_ID:
- return Package_1000;
- case StateMachineEditPart.VISUAL_ID:
- return StateMachine_2000;
- case RegionEditPart.VISUAL_ID:
- return Region_3000;
- case FinalStateEditPart.VISUAL_ID:
- return FinalState_5000;
- case StateEditPart.VISUAL_ID:
- return State_6000;
- case PseudostateInitialEditPart.VISUAL_ID:
- return Pseudostate_8000;
- case PseudostateJoinEditPart.VISUAL_ID:
- return Pseudostate_9000;
- case PseudostateForkEditPart.VISUAL_ID:
- return Pseudostate_10000;
- case PseudostateChoiceEditPart.VISUAL_ID:
- return Pseudostate_11000;
- case PseudostateJunctionEditPart.VISUAL_ID:
- return Pseudostate_12000;
- case PseudostateShallowHistoryEditPart.VISUAL_ID:
- return Pseudostate_13000;
- case PseudostateDeepHistoryEditPart.VISUAL_ID:
- return Pseudostate_14000;
- case PseudostateTerminateEditPart.VISUAL_ID:
- return Pseudostate_15000;
- case PseudostateEntryPointEditPart.VISUAL_ID:
- return Pseudostate_16000;
- case PseudostateExitPointEditPart.VISUAL_ID:
- return Pseudostate_17000;
- case ConnectionPointReferenceEditPart.VISUAL_ID:
- return ConnectionPointReference_18000;
- case TransitionEditPart.VISUAL_ID:
- return Transition_7000;
- case GeneralizationEditPart.VISUAL_ID:
- return Generalization_19000;
- }
- return null;
- }
-
- /**
- * @generated
- */
- private static IElementType getElementType(String id) {
- return ElementTypeRegistry.getInstance().getType(id);
- }
-
- /**
- * @generated
- */
- public static Image getImage(ENamedElement element) {
- 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 Image getImage(IAdaptable hint) {
- ENamedElement element = getElement(hint);
- if(element == null) {
- return null;
- }
- return getImage(element);
- }
-
- /**
- * @generated
- */
- public static ImageDescriptor getImageDescriptor(ENamedElement element) {
- 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 ImageDescriptor getImageDescriptor(IAdaptable hint) {
- ENamedElement element = getElement(hint);
- if(element == null) {
- return null;
- }
- return getImageDescriptor(element);
- }
-
- /**
- * @generated
- */
- private static ImageRegistry getImageRegistry() {
- if(imageRegistry == null) {
- imageRegistry = new ImageRegistry();
- }
- return imageRegistry;
- }
-
- /**
- * @generated
- */
- private static String getImageRegistryKey(ENamedElement element) {
- return element.getName();
- }
-
- /**
- * @generated
- */
- private static ImageDescriptor getProvidedImageDescriptor(ENamedElement element) {
- if(element instanceof EStructuralFeature) {
- EStructuralFeature feature = ((EStructuralFeature)element);
- EClass eContainingClass = feature.getEContainingClass();
- 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) {
- 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 boolean isKnownElementType(IElementType elementType) {
- if(KNOWN_ELEMENT_TYPES == null) {
- KNOWN_ELEMENT_TYPES = new HashSet<IElementType>();
- KNOWN_ELEMENT_TYPES.add(Package_1000);
- KNOWN_ELEMENT_TYPES.add(StateMachine_2000);
- KNOWN_ELEMENT_TYPES.add(Region_3000);
- KNOWN_ELEMENT_TYPES.add(FinalState_5000);
- KNOWN_ELEMENT_TYPES.add(State_6000);
- KNOWN_ELEMENT_TYPES.add(Pseudostate_8000);
- KNOWN_ELEMENT_TYPES.add(Pseudostate_9000);
- KNOWN_ELEMENT_TYPES.add(Pseudostate_10000);
- KNOWN_ELEMENT_TYPES.add(Pseudostate_11000);
- KNOWN_ELEMENT_TYPES.add(Pseudostate_12000);
- KNOWN_ELEMENT_TYPES.add(Pseudostate_13000);
- KNOWN_ELEMENT_TYPES.add(Pseudostate_14000);
- KNOWN_ELEMENT_TYPES.add(Pseudostate_15000);
- KNOWN_ELEMENT_TYPES.add(Pseudostate_16000);
- KNOWN_ELEMENT_TYPES.add(Pseudostate_17000);
- KNOWN_ELEMENT_TYPES.add(ConnectionPointReference_18000);
- KNOWN_ELEMENT_TYPES.add(Transition_7000);
- KNOWN_ELEMENT_TYPES.add(Generalization_19000);
- }
- return KNOWN_ELEMENT_TYPES.contains(elementType);
- }
-
- /**
- * @generated
- */
- private UMLElementTypes() {
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLIconProvider.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLIconProvider.java
deleted file mode 100644
index 753f09305f5..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLIconProvider.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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
- */
-public class UMLIconProvider extends AbstractProvider implements IIconProvider {
-
- /**
- * @generated
- */
- public Image getIcon(IAdaptable hint, int flags) {
- return UMLElementTypes.getImage(hint);
- }
-
- /**
- * @generated
- */
- public boolean provides(IOperation operation) {
- if(operation instanceof GetIconOperation) {
- return ((GetIconOperation)operation).execute(this) != null;
- }
- return false;
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLMarkerNavigationProvider.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLMarkerNavigationProvider.java
deleted file mode 100644
index f60c132604c..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLMarkerNavigationProvider.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorUtil;
-
-/**
- * @generated
- */
-public class UMLMarkerNavigationProvider extends AbstractModelMarkerNavigationProvider {
-
- /**
- * @generated
- */
- public static final String MARKER_TYPE = UMLDiagramEditorPlugin.ID + ".diagnostic"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static IMarker addMarker(IFile file, String elementId, String location, String message, 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.ui.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 (CoreException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Failed to create validation marker", e); //$NON-NLS-1$
- }
- return marker;
- }
-
- /**
- * @generated
- */
- public static void deleteMarkers(IResource resource) {
- try {
- resource.deleteMarkers(MARKER_TYPE, true, IResource.DEPTH_ZERO);
- } catch (CoreException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Failed to delete validation markers", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- protected void doGotoMarker(IMarker marker) {
- String elementId = marker.getAttribute(org.eclipse.gmf.runtime.common.core.resources.IMarker.ELEMENT_ID, null);
- if(elementId == null || !(getEditor() instanceof DiagramEditor)) {
- return;
- }
- DiagramEditor editor = (DiagramEditor)getEditor();
- Map editPartRegistry = editor.getDiagramGraphicalViewer().getEditPartRegistry();
- EObject targetView = editor.getDiagram().eResource().getEObject(elementId);
- if(targetView == null) {
- return;
- }
- EditPart targetEditPart = (EditPart)editPartRegistry.get(targetView);
- if(targetEditPart != null) {
- UMLDiagramEditorUtil.selectElementsInDiagram(editor, Arrays.asList(new EditPart[]{ targetEditPart }));
- }
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLModelingAssistantProvider.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLModelingAssistantProvider.java
deleted file mode 100644
index f8e4a0aa8c2..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLModelingAssistantProvider.java
+++ /dev/null
@@ -1,420 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.diagram.statemachine.edit.parts.ConnectionPointReferenceEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.FinalStateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateChoiceEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateDeepHistoryEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateForkEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateInitialEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJoinEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJunctionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateShallowHistoryEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateTerminateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.Messages;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.dialogs.ElementListSelectionDialog;
-
-/**
- * @generated
- */
-public class UMLModelingAssistantProvider extends ModelingAssistantProvider {
-
- /**
- * @generated
- */
- public List getRelTypesOnSource(IAdaptable source) {
- IGraphicalEditPart sourceEditPart = (IGraphicalEditPart)source.getAdapter(IGraphicalEditPart.class);
- if(sourceEditPart instanceof StateMachineEditPart) {
- return ((StateMachineEditPart)sourceEditPart).getMARelTypesOnSource();
- }
- if(sourceEditPart instanceof FinalStateEditPart) {
- return ((FinalStateEditPart)sourceEditPart).getMARelTypesOnSource();
- }
- if(sourceEditPart instanceof StateEditPart) {
- return ((StateEditPart)sourceEditPart).getMARelTypesOnSource();
- }
- if(sourceEditPart instanceof PseudostateInitialEditPart) {
- return ((PseudostateInitialEditPart)sourceEditPart).getMARelTypesOnSource();
- }
- if(sourceEditPart instanceof PseudostateJoinEditPart) {
- return ((PseudostateJoinEditPart)sourceEditPart).getMARelTypesOnSource();
- }
- if(sourceEditPart instanceof PseudostateForkEditPart) {
- return ((PseudostateForkEditPart)sourceEditPart).getMARelTypesOnSource();
- }
- if(sourceEditPart instanceof PseudostateChoiceEditPart) {
- return ((PseudostateChoiceEditPart)sourceEditPart).getMARelTypesOnSource();
- }
- if(sourceEditPart instanceof PseudostateJunctionEditPart) {
- return ((PseudostateJunctionEditPart)sourceEditPart).getMARelTypesOnSource();
- }
- if(sourceEditPart instanceof PseudostateShallowHistoryEditPart) {
- return ((PseudostateShallowHistoryEditPart)sourceEditPart).getMARelTypesOnSource();
- }
- if(sourceEditPart instanceof PseudostateDeepHistoryEditPart) {
- return ((PseudostateDeepHistoryEditPart)sourceEditPart).getMARelTypesOnSource();
- }
- if(sourceEditPart instanceof PseudostateTerminateEditPart) {
- return ((PseudostateTerminateEditPart)sourceEditPart).getMARelTypesOnSource();
- }
- if(sourceEditPart instanceof PseudostateEntryPointEditPart) {
- return ((PseudostateEntryPointEditPart)sourceEditPart).getMARelTypesOnSource();
- }
- if(sourceEditPart instanceof PseudostateExitPointEditPart) {
- return ((PseudostateExitPointEditPart)sourceEditPart).getMARelTypesOnSource();
- }
- if(sourceEditPart instanceof ConnectionPointReferenceEditPart) {
- return ((ConnectionPointReferenceEditPart)sourceEditPart).getMARelTypesOnSource();
- }
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public List getRelTypesOnSourceAndTarget(IAdaptable source, IAdaptable target) {
- IGraphicalEditPart sourceEditPart = (IGraphicalEditPart)source.getAdapter(IGraphicalEditPart.class);
- IGraphicalEditPart targetEditPart = (IGraphicalEditPart)target.getAdapter(IGraphicalEditPart.class);
- if(sourceEditPart instanceof StateMachineEditPart) {
- return ((StateMachineEditPart)sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
- }
- if(sourceEditPart instanceof FinalStateEditPart) {
- return ((FinalStateEditPart)sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
- }
- if(sourceEditPart instanceof StateEditPart) {
- return ((StateEditPart)sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
- }
- if(sourceEditPart instanceof PseudostateInitialEditPart) {
- return ((PseudostateInitialEditPart)sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
- }
- if(sourceEditPart instanceof PseudostateJoinEditPart) {
- return ((PseudostateJoinEditPart)sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
- }
- if(sourceEditPart instanceof PseudostateForkEditPart) {
- return ((PseudostateForkEditPart)sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
- }
- if(sourceEditPart instanceof PseudostateChoiceEditPart) {
- return ((PseudostateChoiceEditPart)sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
- }
- if(sourceEditPart instanceof PseudostateJunctionEditPart) {
- return ((PseudostateJunctionEditPart)sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
- }
- if(sourceEditPart instanceof PseudostateShallowHistoryEditPart) {
- return ((PseudostateShallowHistoryEditPart)sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
- }
- if(sourceEditPart instanceof PseudostateDeepHistoryEditPart) {
- return ((PseudostateDeepHistoryEditPart)sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
- }
- if(sourceEditPart instanceof PseudostateTerminateEditPart) {
- return ((PseudostateTerminateEditPart)sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
- }
- if(sourceEditPart instanceof PseudostateEntryPointEditPart) {
- return ((PseudostateEntryPointEditPart)sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
- }
- if(sourceEditPart instanceof PseudostateExitPointEditPart) {
- return ((PseudostateExitPointEditPart)sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
- }
- if(sourceEditPart instanceof ConnectionPointReferenceEditPart) {
- return ((ConnectionPointReferenceEditPart)sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
- }
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public List getRelTypesOnTarget(IAdaptable target) {
- IGraphicalEditPart targetEditPart = (IGraphicalEditPart)target.getAdapter(IGraphicalEditPart.class);
- if(targetEditPart instanceof StateMachineEditPart) {
- return ((StateMachineEditPart)targetEditPart).getMARelTypesOnTarget();
- }
- if(targetEditPart instanceof FinalStateEditPart) {
- return ((FinalStateEditPart)targetEditPart).getMARelTypesOnTarget();
- }
- if(targetEditPart instanceof StateEditPart) {
- return ((StateEditPart)targetEditPart).getMARelTypesOnTarget();
- }
- if(targetEditPart instanceof PseudostateInitialEditPart) {
- return ((PseudostateInitialEditPart)targetEditPart).getMARelTypesOnTarget();
- }
- if(targetEditPart instanceof PseudostateJoinEditPart) {
- return ((PseudostateJoinEditPart)targetEditPart).getMARelTypesOnTarget();
- }
- if(targetEditPart instanceof PseudostateForkEditPart) {
- return ((PseudostateForkEditPart)targetEditPart).getMARelTypesOnTarget();
- }
- if(targetEditPart instanceof PseudostateChoiceEditPart) {
- return ((PseudostateChoiceEditPart)targetEditPart).getMARelTypesOnTarget();
- }
- if(targetEditPart instanceof PseudostateJunctionEditPart) {
- return ((PseudostateJunctionEditPart)targetEditPart).getMARelTypesOnTarget();
- }
- if(targetEditPart instanceof PseudostateShallowHistoryEditPart) {
- return ((PseudostateShallowHistoryEditPart)targetEditPart).getMARelTypesOnTarget();
- }
- if(targetEditPart instanceof PseudostateDeepHistoryEditPart) {
- return ((PseudostateDeepHistoryEditPart)targetEditPart).getMARelTypesOnTarget();
- }
- if(targetEditPart instanceof PseudostateTerminateEditPart) {
- return ((PseudostateTerminateEditPart)targetEditPart).getMARelTypesOnTarget();
- }
- if(targetEditPart instanceof PseudostateEntryPointEditPart) {
- return ((PseudostateEntryPointEditPart)targetEditPart).getMARelTypesOnTarget();
- }
- if(targetEditPart instanceof PseudostateExitPointEditPart) {
- return ((PseudostateExitPointEditPart)targetEditPart).getMARelTypesOnTarget();
- }
- if(targetEditPart instanceof ConnectionPointReferenceEditPart) {
- return ((ConnectionPointReferenceEditPart)targetEditPart).getMARelTypesOnTarget();
- }
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public List getTypesForPopupBar(IAdaptable host) {
- IGraphicalEditPart editPart = (IGraphicalEditPart)host.getAdapter(IGraphicalEditPart.class);
- if(editPart instanceof PackageEditPart) {
- ArrayList<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.StateMachine_2000);
- return types;
- }
- if(editPart instanceof StateMachineEditPart) {
- ArrayList<IElementType> types = new ArrayList<IElementType>(2);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- return types;
- }
- if(editPart instanceof StateEditPart) {
- ArrayList<IElementType> types = new ArrayList<IElementType>(4);
- types.add(UMLElementTypes.Region_3000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- return types;
- }
- if(editPart instanceof RegionCompartmentEditPart) {
- ArrayList<IElementType> types = new ArrayList<IElementType>(12);
- types.add(UMLElementTypes.Pseudostate_8000);
- types.add(UMLElementTypes.Pseudostate_9000);
- types.add(UMLElementTypes.Pseudostate_10000);
- types.add(UMLElementTypes.Pseudostate_11000);
- types.add(UMLElementTypes.Pseudostate_12000);
- types.add(UMLElementTypes.Pseudostate_13000);
- types.add(UMLElementTypes.Pseudostate_14000);
- types.add(UMLElementTypes.Pseudostate_15000);
- types.add(UMLElementTypes.FinalState_5000);
- types.add(UMLElementTypes.State_6000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- return types;
- }
- if(editPart instanceof StateMachineCompartmentEditPart) {
- ArrayList<IElementType> types = new ArrayList<IElementType>(3);
- types.add(UMLElementTypes.Region_3000);
- types.add(UMLElementTypes.Pseudostate_16000);
- types.add(UMLElementTypes.Pseudostate_17000);
- return types;
- }
- if(editPart instanceof StateCompartmentEditPart) {
- ArrayList<IElementType> types = new ArrayList<IElementType>(2);
- types.add(UMLElementTypes.Region_3000);
- types.add(UMLElementTypes.ConnectionPointReference_18000);
- return types;
- }
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public List getTypesForSource(IAdaptable target, IElementType relationshipType) {
- IGraphicalEditPart targetEditPart = (IGraphicalEditPart)target.getAdapter(IGraphicalEditPart.class);
- if(targetEditPart instanceof StateMachineEditPart) {
- return ((StateMachineEditPart)targetEditPart).getMATypesForSource(relationshipType);
- }
- if(targetEditPart instanceof FinalStateEditPart) {
- return ((FinalStateEditPart)targetEditPart).getMATypesForSource(relationshipType);
- }
- if(targetEditPart instanceof StateEditPart) {
- return ((StateEditPart)targetEditPart).getMATypesForSource(relationshipType);
- }
- if(targetEditPart instanceof PseudostateInitialEditPart) {
- return ((PseudostateInitialEditPart)targetEditPart).getMATypesForSource(relationshipType);
- }
- if(targetEditPart instanceof PseudostateJoinEditPart) {
- return ((PseudostateJoinEditPart)targetEditPart).getMATypesForSource(relationshipType);
- }
- if(targetEditPart instanceof PseudostateForkEditPart) {
- return ((PseudostateForkEditPart)targetEditPart).getMATypesForSource(relationshipType);
- }
- if(targetEditPart instanceof PseudostateChoiceEditPart) {
- return ((PseudostateChoiceEditPart)targetEditPart).getMATypesForSource(relationshipType);
- }
- if(targetEditPart instanceof PseudostateJunctionEditPart) {
- return ((PseudostateJunctionEditPart)targetEditPart).getMATypesForSource(relationshipType);
- }
- if(targetEditPart instanceof PseudostateShallowHistoryEditPart) {
- return ((PseudostateShallowHistoryEditPart)targetEditPart).getMATypesForSource(relationshipType);
- }
- if(targetEditPart instanceof PseudostateDeepHistoryEditPart) {
- return ((PseudostateDeepHistoryEditPart)targetEditPart).getMATypesForSource(relationshipType);
- }
- if(targetEditPart instanceof PseudostateTerminateEditPart) {
- return ((PseudostateTerminateEditPart)targetEditPart).getMATypesForSource(relationshipType);
- }
- if(targetEditPart instanceof PseudostateEntryPointEditPart) {
- return ((PseudostateEntryPointEditPart)targetEditPart).getMATypesForSource(relationshipType);
- }
- if(targetEditPart instanceof PseudostateExitPointEditPart) {
- return ((PseudostateExitPointEditPart)targetEditPart).getMATypesForSource(relationshipType);
- }
- if(targetEditPart instanceof ConnectionPointReferenceEditPart) {
- return ((ConnectionPointReferenceEditPart)targetEditPart).getMATypesForSource(relationshipType);
- }
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- public List getTypesForTarget(IAdaptable source, IElementType relationshipType) {
- IGraphicalEditPart sourceEditPart = (IGraphicalEditPart)source.getAdapter(IGraphicalEditPart.class);
- if(sourceEditPart instanceof StateMachineEditPart) {
- return ((StateMachineEditPart)sourceEditPart).getMATypesForTarget(relationshipType);
- }
- if(sourceEditPart instanceof FinalStateEditPart) {
- return ((FinalStateEditPart)sourceEditPart).getMATypesForTarget(relationshipType);
- }
- if(sourceEditPart instanceof StateEditPart) {
- return ((StateEditPart)sourceEditPart).getMATypesForTarget(relationshipType);
- }
- if(sourceEditPart instanceof PseudostateInitialEditPart) {
- return ((PseudostateInitialEditPart)sourceEditPart).getMATypesForTarget(relationshipType);
- }
- if(sourceEditPart instanceof PseudostateJoinEditPart) {
- return ((PseudostateJoinEditPart)sourceEditPart).getMATypesForTarget(relationshipType);
- }
- if(sourceEditPart instanceof PseudostateForkEditPart) {
- return ((PseudostateForkEditPart)sourceEditPart).getMATypesForTarget(relationshipType);
- }
- if(sourceEditPart instanceof PseudostateChoiceEditPart) {
- return ((PseudostateChoiceEditPart)sourceEditPart).getMATypesForTarget(relationshipType);
- }
- if(sourceEditPart instanceof PseudostateJunctionEditPart) {
- return ((PseudostateJunctionEditPart)sourceEditPart).getMATypesForTarget(relationshipType);
- }
- if(sourceEditPart instanceof PseudostateShallowHistoryEditPart) {
- return ((PseudostateShallowHistoryEditPart)sourceEditPart).getMATypesForTarget(relationshipType);
- }
- if(sourceEditPart instanceof PseudostateDeepHistoryEditPart) {
- return ((PseudostateDeepHistoryEditPart)sourceEditPart).getMATypesForTarget(relationshipType);
- }
- if(sourceEditPart instanceof PseudostateTerminateEditPart) {
- return ((PseudostateTerminateEditPart)sourceEditPart).getMATypesForTarget(relationshipType);
- }
- if(sourceEditPart instanceof PseudostateEntryPointEditPart) {
- return ((PseudostateEntryPointEditPart)sourceEditPart).getMATypesForTarget(relationshipType);
- }
- if(sourceEditPart instanceof PseudostateExitPointEditPart) {
- return ((PseudostateExitPointEditPart)sourceEditPart).getMATypesForTarget(relationshipType);
- }
- if(sourceEditPart instanceof ConnectionPointReferenceEditPart) {
- return ((ConnectionPointReferenceEditPart)sourceEditPart).getMATypesForTarget(relationshipType);
- }
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- protected boolean isApplicableElement(EObject element, Collection types) {
- IElementType type = ElementTypeRegistry.getInstance().getElementType(element);
- return types.contains(type);
- }
-
- /**
- * @generated
- */
- protected EObject selectElement(EObject[] elements) {
- Shell shell = Display.getCurrent().getActiveShell();
- ILabelProvider labelProvider = new AdapterFactoryLabelProvider(UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory());
- 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;
- }
-
- /**
- * @generated
- */
- protected EObject selectExistingElement(IAdaptable host, Collection types) {
- if(types.isEmpty()) {
- return null;
- }
- IGraphicalEditPart editPart = (IGraphicalEditPart)host.getAdapter(IGraphicalEditPart.class);
- if(editPart == null) {
- return null;
- }
- Diagram diagram = (Diagram)editPart.getRoot().getContents().getModel();
- HashSet<EObject> elements = new HashSet<EObject>();
- for(Iterator<EObject> it = diagram.getElement().eAllContents(); it.hasNext();) {
- EObject element = it.next();
- if(isApplicableElement(element, types)) {
- elements.add(element);
- }
- }
- if(elements.isEmpty()) {
- return null;
- }
- return selectElement((EObject[])elements.toArray(new EObject[elements.size()]));
- }
-
- /**
- * @generated
- */
- public EObject selectExistingElementForSource(IAdaptable target, IElementType relationshipType) {
- return selectExistingElement(target, getTypesForSource(target, relationshipType));
- }
-
- /**
- * @generated
- */
- public EObject selectExistingElementForTarget(IAdaptable source, IElementType relationshipType) {
- return selectExistingElement(source, getTypesForTarget(source, relationshipType));
- }
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLParserProvider.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLParserProvider.java
deleted file mode 100644
index bc378dc946d..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLParserProvider.java
+++ /dev/null
@@ -1,678 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.diagram.common.parser.stereotype.AppliedStereotypeParser;
-import org.eclipse.papyrus.diagram.statemachine.custom.parsers.TransitionPropertiesParser;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.ConnectionPointReferenceNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.ConnectionPointReferenceStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.FinalStateNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.FinalStateStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.GeneralizationStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateChoiceNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateChoiceStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateDeepHistoryNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateDeepHistoryStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateForkNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateForkStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateInitialNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateInitialStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJoinNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJoinStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJunctionNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJunctionStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateShallowHistoryNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateShallowHistoryStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateTerminateNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateTerminateStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionGuardEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.parsers.MessageFormatParser;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class UMLParserProvider extends AbstractProvider implements IParserProvider {
-
- /**
- * @generated
- */
- private static class HintAdapter extends ParserHintAdapter {
-
- /**
- * @generated
- */
- private final IElementType elementType;
-
- /**
- * @generated
- */
- public HintAdapter(IElementType type, EObject object, String parserHint) {
- super(object, parserHint);
- assert type != null;
- elementType = type;
- }
-
- /**
- * @generated
- */
- public Object getAdapter(Class adapter) {
- if(IElementType.class.equals(adapter)) {
- return elementType;
- }
- return super.getAdapter(adapter);
- }
- }
-
- /**
- * Utility method that consults ParserService
- *
- * @generated
- */
- public static IParser getParser(IElementType type, EObject object, String parserHint) {
- return ParserService.getInstance().getParser(new HintAdapter(type, object, parserHint));
- }
-
- /**
- * @generated
- */
- private IParser stateMachineName_2001Parser;
-
- /**
- * @generated
- */
- private IParser finalStateName_5001Parser;
-
- /**
- * @generated
- */
- private IParser stateName_6001Parser;
-
- /**
- * @generated
- */
- private AppliedStereotypeParser finalStateName_5002Parser;
-
- /**
- * @generated
- */
- private IParser transitionName_7001Parser;
-
- /**
- * @generated
- */
- private TransitionPropertiesParser transitionGuard_7002Parser;
-
- /**
- * @generated
- */
- private IParser pseudostateName_8001Parser;
-
- /**
- * @generated
- */
- private AppliedStereotypeParser pseudostateName_8002Parser;
-
- /**
- * @generated
- */
- private IParser pseudostateName_9001Parser;
-
- /**
- * @generated
- */
- private AppliedStereotypeParser pseudostateName_9002Parser;
-
- /**
- * @generated
- */
- private IParser pseudostateName_10001Parser;
-
- /**
- * @generated
- */
- private AppliedStereotypeParser pseudostateName_10002Parser;
-
- /**
- * @generated
- */
- private IParser pseudostateName_11001Parser;
-
- /**
- * @generated
- */
- private AppliedStereotypeParser pseudostateName_11002Parser;
-
- /**
- * @generated
- */
- private IParser pseudostateName_12001Parser;
-
- /**
- * @generated
- */
- private AppliedStereotypeParser pseudostateName_12002Parser;
-
- /**
- * @generated
- */
- private IParser pseudostateName_13001Parser;
-
- /**
- * @generated
- */
- private AppliedStereotypeParser pseudostateName_13002Parser;
-
- /**
- * @generated
- */
- private IParser pseudostateName_14001Parser;
-
- /**
- * @generated
- */
- private AppliedStereotypeParser pseudostateName_14002Parser;
-
- /**
- * @generated
- */
- private IParser pseudostateName_15001Parser;
-
- /**
- * @generated
- */
- private AppliedStereotypeParser pseudostateName_15002Parser;
-
- /**
- * @generated
- */
- private IParser pseudostateName_16001Parser;
-
- /**
- * @generated
- */
- private AppliedStereotypeParser pseudostateName_16002Parser;
-
- /**
- * @generated
- */
- private IParser pseudostateName_17001Parser;
-
- /**
- * @generated
- */
- private AppliedStereotypeParser pseudostateName_17002Parser;
-
- /**
- * @generated
- */
- private AppliedStereotypeParser transitionName_7003Parser;
-
- /**
- * @generated
- */
- private IParser connectionPointReferenceName_18001Parser;
-
- /**
- * @generated
- */
- private AppliedStereotypeParser connectionPointReferenceName_18002Parser;
-
- /**
- * @generated
- */
- private IParser generalizationIsSubstitutable_19002Parser;
-
- /**
- * @generated
- */
- private IParser getConnectionPointReferenceName_18001Parser() {
- if(connectionPointReferenceName_18001Parser == null) {
- EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() };
- MessageFormatParser parser = new MessageFormatParser(features);
- connectionPointReferenceName_18001Parser = parser;
- }
- return connectionPointReferenceName_18001Parser;
- }
-
- /**
- * @generated
- */
- private IParser getConnectionPointReferenceName_18002Parser() {
- if(connectionPointReferenceName_18002Parser == null) {
- connectionPointReferenceName_18002Parser = new AppliedStereotypeParser();
- }
- return connectionPointReferenceName_18002Parser;
- }
-
- /**
- * @generated
- */
- private IParser getFinalStateName_5001Parser() {
- if(finalStateName_5001Parser == null) {
- EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() };
- MessageFormatParser parser = new MessageFormatParser(features);
- finalStateName_5001Parser = parser;
- }
- return finalStateName_5001Parser;
- }
-
- /**
- * @generated
- */
- private IParser getFinalStateName_5002Parser() {
- if(finalStateName_5002Parser == null) {
- finalStateName_5002Parser = new AppliedStereotypeParser();
- }
- return finalStateName_5002Parser;
- }
-
- /**
- * @generated
- */
- private IParser getGeneralizationIsSubstitutable_19002Parser() {
- if(generalizationIsSubstitutable_19002Parser == null) {
- EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getGeneralization_IsSubstitutable() };
- MessageFormatParser parser = new MessageFormatParser(features);
- parser.setViewPattern("<<{0}>>"); //$NON-NLS-1$
- parser.setEditorPattern("<<{0}>>"); //$NON-NLS-1$
- parser.setEditPattern("<<{0}>>"); //$NON-NLS-1$
- generalizationIsSubstitutable_19002Parser = parser;
- }
- return generalizationIsSubstitutable_19002Parser;
- }
-
- /**
- * @generated
- */
- public IParser getParser(IAdaptable hint) {
- String vid = (String)hint.getAdapter(String.class);
- if(vid != null) {
- return getParser(UMLVisualIDRegistry.getVisualID(vid));
- }
- View view = (View)hint.getAdapter(View.class);
- if(view != null) {
- return getParser(UMLVisualIDRegistry.getVisualID(view));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected IParser getParser(int visualID) {
- switch(visualID) {
- case StateMachineNameEditPart.VISUAL_ID:
- return getStateMachineName_2001Parser();
- case FinalStateNameEditPart.VISUAL_ID:
- return getFinalStateName_5001Parser();
- case FinalStateStereotypeEditPart.VISUAL_ID:
- return getFinalStateName_5002Parser();
- case StateNameEditPart.VISUAL_ID:
- return getStateName_6001Parser();
- case PseudostateInitialNameEditPart.VISUAL_ID:
- return getPseudostateName_8001Parser();
- case PseudostateInitialStereotypeEditPart.VISUAL_ID:
- return getPseudostateName_8002Parser();
- case PseudostateJoinNameEditPart.VISUAL_ID:
- return getPseudostateName_9001Parser();
- case PseudostateJoinStereotypeEditPart.VISUAL_ID:
- return getPseudostateName_9002Parser();
- case PseudostateForkNameEditPart.VISUAL_ID:
- return getPseudostateName_10001Parser();
- case PseudostateForkStereotypeEditPart.VISUAL_ID:
- return getPseudostateName_10002Parser();
- case PseudostateChoiceNameEditPart.VISUAL_ID:
- return getPseudostateName_11001Parser();
- case PseudostateChoiceStereotypeEditPart.VISUAL_ID:
- return getPseudostateName_11002Parser();
- case PseudostateJunctionNameEditPart.VISUAL_ID:
- return getPseudostateName_12001Parser();
- case PseudostateJunctionStereotypeEditPart.VISUAL_ID:
- return getPseudostateName_12002Parser();
- case PseudostateShallowHistoryNameEditPart.VISUAL_ID:
- return getPseudostateName_13001Parser();
- case PseudostateShallowHistoryStereotypeEditPart.VISUAL_ID:
- return getPseudostateName_13002Parser();
- case PseudostateDeepHistoryNameEditPart.VISUAL_ID:
- return getPseudostateName_14001Parser();
- case PseudostateDeepHistoryStereotypeEditPart.VISUAL_ID:
- return getPseudostateName_14002Parser();
- case PseudostateTerminateNameEditPart.VISUAL_ID:
- return getPseudostateName_15001Parser();
- case PseudostateTerminateStereotypeEditPart.VISUAL_ID:
- return getPseudostateName_15002Parser();
- case PseudostateEntryPointNameEditPart.VISUAL_ID:
- return getPseudostateName_16001Parser();
- case PseudostateEntryPointStereotypeEditPart.VISUAL_ID:
- return getPseudostateName_16002Parser();
- case PseudostateExitPointNameEditPart.VISUAL_ID:
- return getPseudostateName_17001Parser();
- case PseudostateExitPointStereotypeEditPart.VISUAL_ID:
- return getPseudostateName_17002Parser();
- case ConnectionPointReferenceNameEditPart.VISUAL_ID:
- return getConnectionPointReferenceName_18001Parser();
- case ConnectionPointReferenceStereotypeEditPart.VISUAL_ID:
- return getConnectionPointReferenceName_18002Parser();
- case TransitionNameEditPart.VISUAL_ID:
- return getTransitionName_7001Parser();
- case TransitionGuardEditPart.VISUAL_ID:
- return getTransitionGuard_7002Parser();
- case TransitionStereotypeEditPart.VISUAL_ID:
- return getTransitionName_7003Parser();
- case GeneralizationStereotypeEditPart.VISUAL_ID:
- return getGeneralizationIsSubstitutable_19002Parser();
- }
- return null;
- }
-
- /**
- * @generated
- */
- private IParser getPseudostateName_10001Parser() {
- if(pseudostateName_10001Parser == null) {
- EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() };
- MessageFormatParser parser = new MessageFormatParser(features);
- pseudostateName_10001Parser = parser;
- }
- return pseudostateName_10001Parser;
- }
-
- /**
- * @generated
- */
- private IParser getPseudostateName_10002Parser() {
- if(pseudostateName_10002Parser == null) {
- pseudostateName_10002Parser = new AppliedStereotypeParser();
- }
- return pseudostateName_10002Parser;
- }
-
- /**
- * @generated
- */
- private IParser getPseudostateName_11001Parser() {
- if(pseudostateName_11001Parser == null) {
- EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() };
- MessageFormatParser parser = new MessageFormatParser(features);
- pseudostateName_11001Parser = parser;
- }
- return pseudostateName_11001Parser;
- }
-
- /**
- * @generated
- */
- private IParser getPseudostateName_11002Parser() {
- if(pseudostateName_11002Parser == null) {
- pseudostateName_11002Parser = new AppliedStereotypeParser();
- }
- return pseudostateName_11002Parser;
- }
-
- /**
- * @generated
- */
- private IParser getPseudostateName_12001Parser() {
- if(pseudostateName_12001Parser == null) {
- EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() };
- MessageFormatParser parser = new MessageFormatParser(features);
- pseudostateName_12001Parser = parser;
- }
- return pseudostateName_12001Parser;
- }
-
- /**
- * @generated
- */
- private IParser getPseudostateName_12002Parser() {
- if(pseudostateName_12002Parser == null) {
- pseudostateName_12002Parser = new AppliedStereotypeParser();
- }
- return pseudostateName_12002Parser;
- }
-
- /**
- * @generated
- */
- private IParser getPseudostateName_13001Parser() {
- if(pseudostateName_13001Parser == null) {
- EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() };
- MessageFormatParser parser = new MessageFormatParser(features);
- pseudostateName_13001Parser = parser;
- }
- return pseudostateName_13001Parser;
- }
-
- /**
- * @generated
- */
- private IParser getPseudostateName_13002Parser() {
- if(pseudostateName_13002Parser == null) {
- pseudostateName_13002Parser = new AppliedStereotypeParser();
- }
- return pseudostateName_13002Parser;
- }
-
- /**
- * @generated
- */
- private IParser getPseudostateName_14001Parser() {
- if(pseudostateName_14001Parser == null) {
- EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() };
- MessageFormatParser parser = new MessageFormatParser(features);
- pseudostateName_14001Parser = parser;
- }
- return pseudostateName_14001Parser;
- }
-
- /**
- * @generated
- */
- private IParser getPseudostateName_14002Parser() {
- if(pseudostateName_14002Parser == null) {
- pseudostateName_14002Parser = new AppliedStereotypeParser();
- }
- return pseudostateName_14002Parser;
- }
-
- /**
- * @generated
- */
- private IParser getPseudostateName_15001Parser() {
- if(pseudostateName_15001Parser == null) {
- EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() };
- MessageFormatParser parser = new MessageFormatParser(features);
- pseudostateName_15001Parser = parser;
- }
- return pseudostateName_15001Parser;
- }
-
- /**
- * @generated
- */
- private IParser getPseudostateName_15002Parser() {
- if(pseudostateName_15002Parser == null) {
- pseudostateName_15002Parser = new AppliedStereotypeParser();
- }
- return pseudostateName_15002Parser;
- }
-
- /**
- * @generated
- */
- private IParser getPseudostateName_16001Parser() {
- if(pseudostateName_16001Parser == null) {
- EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() };
- MessageFormatParser parser = new MessageFormatParser(features);
- pseudostateName_16001Parser = parser;
- }
- return pseudostateName_16001Parser;
- }
-
- /**
- * @generated
- */
- private IParser getPseudostateName_16002Parser() {
- if(pseudostateName_16002Parser == null) {
- pseudostateName_16002Parser = new AppliedStereotypeParser();
- }
- return pseudostateName_16002Parser;
- }
-
- /**
- * @generated
- */
- private IParser getPseudostateName_17001Parser() {
- if(pseudostateName_17001Parser == null) {
- EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() };
- MessageFormatParser parser = new MessageFormatParser(features);
- pseudostateName_17001Parser = parser;
- }
- return pseudostateName_17001Parser;
- }
-
- /**
- * @generated
- */
- private IParser getPseudostateName_17002Parser() {
- if(pseudostateName_17002Parser == null) {
- pseudostateName_17002Parser = new AppliedStereotypeParser();
- }
- return pseudostateName_17002Parser;
- }
-
- /**
- * @generated
- */
- private IParser getPseudostateName_8001Parser() {
- if(pseudostateName_8001Parser == null) {
- EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() };
- MessageFormatParser parser = new MessageFormatParser(features);
- pseudostateName_8001Parser = parser;
- }
- return pseudostateName_8001Parser;
- }
-
- /**
- * @generated
- */
- private IParser getPseudostateName_8002Parser() {
- if(pseudostateName_8002Parser == null) {
- pseudostateName_8002Parser = new AppliedStereotypeParser();
- }
- return pseudostateName_8002Parser;
- }
-
- /**
- * @generated
- */
- private IParser getPseudostateName_9001Parser() {
- if(pseudostateName_9001Parser == null) {
- EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() };
- MessageFormatParser parser = new MessageFormatParser(features);
- pseudostateName_9001Parser = parser;
- }
- return pseudostateName_9001Parser;
- }
-
- /**
- * @generated
- */
- private IParser getPseudostateName_9002Parser() {
- if(pseudostateName_9002Parser == null) {
- pseudostateName_9002Parser = new AppliedStereotypeParser();
- }
- return pseudostateName_9002Parser;
- }
-
- /**
- * @generated
- */
- private IParser getStateMachineName_2001Parser() {
- if(stateMachineName_2001Parser == null) {
- EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() };
- MessageFormatParser parser = new MessageFormatParser(features);
- stateMachineName_2001Parser = parser;
- }
- return stateMachineName_2001Parser;
- }
-
- /**
- * @generated
- */
- private IParser getStateName_6001Parser() {
- if(stateName_6001Parser == null) {
- EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() };
- MessageFormatParser parser = new MessageFormatParser(features);
- stateName_6001Parser = parser;
- }
- return stateName_6001Parser;
- }
-
- /**
- * @generated
- */
- private IParser getTransitionGuard_7002Parser() {
- if(transitionGuard_7002Parser == null) {
- transitionGuard_7002Parser = new TransitionPropertiesParser();
- }
- return transitionGuard_7002Parser;
- }
-
- /**
- * @generated
- */
- private IParser getTransitionName_7001Parser() {
- if(transitionName_7001Parser == null) {
- EAttribute[] features = new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() };
- MessageFormatParser parser = new MessageFormatParser(features);
- transitionName_7001Parser = parser;
- }
- return transitionName_7001Parser;
- }
-
- /**
- * @generated
- */
- private IParser getTransitionName_7003Parser() {
- if(transitionName_7003Parser == null) {
- transitionName_7003Parser = new AppliedStereotypeParser();
- }
- return transitionName_7003Parser;
- }
-
- /**
- * @generated
- */
- public boolean provides(IOperation operation) {
- if(operation instanceof GetParserOperation) {
- IAdaptable hint = ((GetParserOperation)operation).getHint();
- if(UMLElementTypes.getElement(hint) == null) {
- return false;
- }
- return getParser(hint) != null;
- }
- return false;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLValidationDecoratorProvider.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLValidationDecoratorProvider.java
deleted file mode 100644
index aeff7172b54..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLValidationDecoratorProvider.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.diagram.common.providers.ValidationDecoratorProvider;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditor;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-
-/**
- * @generated
- */
-public class UMLValidationDecoratorProvider extends ValidationDecoratorProvider implements IDecoratorProvider {
-
- /**
- * @generated
- */
- public void createDecorators(IDecoratorTarget decoratorTarget) {
- EditPart editPart = (EditPart)decoratorTarget.getAdapter(EditPart.class);
- if(editPart instanceof GraphicalEditPart || editPart instanceof AbstractConnectionEditPart) {
- Object model = editPart.getModel();
- if((model instanceof View)) {
- View view = (View)model;
- if(!(view instanceof Edge) && !view.isSetElement()) {
- return;
- }
- }
- EditDomain ed = editPart.getViewer().getEditDomain();
- if(!(ed instanceof DiagramEditDomain)) {
- return;
- }
- if(((DiagramEditDomain)ed).getEditorPart() instanceof UMLDiagramEditor) {
- decoratorTarget.installDecorator(KEY, new StatusDecorator(decoratorTarget));
- }
- }
- }
-
- /**
- * @generated
- */
- public boolean provides(IOperation operation) {
- if(!(operation instanceof CreateDecoratorsOperation)) {
- return false;
- }
- IDecoratorTarget decoratorTarget = ((CreateDecoratorsOperation)operation).getDecoratorTarget();
- View view = (View)decoratorTarget.getAdapter(View.class);
- return view != null && PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view));
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLValidationProvider.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLValidationProvider.java
deleted file mode 100644
index d3b7d72d1ae..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLValidationProvider.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.providers;
-
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-
-/**
- * @generated
- */
-public class UMLValidationProvider {
-
- /**
- * @generated
- */
- private static boolean constraintsActive = false;
-
- /**
- * @generated
- */
- static boolean isInDefaultEditorContext(Object object) {
- if(shouldConstraintsBePrivate() && !constraintsActive) {
- return false;
- }
- if(object instanceof View) {
- return constraintsActive && PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID((View)object));
- }
- return true;
- }
-
- /**
- * @generated
- */
- public static void runWithConstraints(TransactionalEditingDomain editingDomain, Runnable operation) {
- final Runnable op = operation;
- Runnable task = new Runnable() {
-
- public void run() {
- try {
- constraintsActive = true;
- op.run();
- } finally {
- constraintsActive = false;
- }
- }
- };
- if(editingDomain != null) {
- try {
- editingDomain.runExclusive(task);
- } catch (Exception e) {
- UMLDiagramEditorPlugin.getInstance().logError("Validation failed", e); //$NON-NLS-1$
- }
- } else {
- task.run();
- }
- }
-
- /**
- * @generated
- */
- public static boolean shouldConstraintsBePrivate() {
- return false;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLViewProvider.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLViewProvider.java
deleted file mode 100644
index 95f2f80fb4c..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/providers/UMLViewProvider.java
+++ /dev/null
@@ -1,993 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.ConnectionPointReferenceEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.ConnectionPointReferenceNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.ConnectionPointReferenceStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.FinalStateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.FinalStateNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.FinalStateStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.GeneralizationStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateChoiceEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateChoiceNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateChoiceStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateDeepHistoryEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateDeepHistoryNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateDeepHistoryStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateEntryPointStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateExitPointStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateForkEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateForkNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateForkStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateInitialEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateInitialNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateInitialStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJoinEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJoinNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJoinStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJunctionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJunctionNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateJunctionStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateShallowHistoryEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateShallowHistoryNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateShallowHistoryStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateTerminateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateTerminateNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.PseudostateTerminateStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineCompartmentEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionGuardEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionNameEditPart;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionStereotypeEditPart;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.FontData;
-
-/**
- * @generated
- */
-public class UMLViewProvider extends AbstractProvider implements IViewProvider {
-
- /**
- * @generated
- */
- protected Node createCompartment(View owner, String hint, boolean canCollapse, boolean hasTitle, boolean canSort, 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) {
- 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
- */
- public Node createConnectionPointReference_18000(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(ConnectionPointReferenceEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "ConnectionPointReference");
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ConnectionPointReference");
-
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "ConnectionPointReference");
-
- Node label18001 = createLabel(node, UMLVisualIDRegistry.getType(ConnectionPointReferenceNameEditPart.VISUAL_ID));
- label18001.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- Location location18001 = (Location)label18001.getLayoutConstraint();
- location18001.setX(25);
- location18001.setY(3);
- Node label18002 = createLabel(node, UMLVisualIDRegistry.getType(ConnectionPointReferenceStereotypeEditPart.VISUAL_ID));
- label18002.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- Location location18002 = (Location)label18002.getLayoutConstraint();
- location18002.setX(25);
- location18002.setY(-10);
-
- return node;
- }
-
- /**
- * @generated
- */
- public Diagram createDiagram(IAdaptable semanticAdapter, String diagramKind, PreferencesHint preferencesHint) {
- Diagram diagram = NotationFactory.eINSTANCE.createDiagram();
- diagram.getStyles().add(NotationFactory.eINSTANCE.createDiagramStyle());
- diagram.setType(PackageEditPart.MODEL_ID);
- diagram.setElement(getSemanticElement(semanticAdapter));
- diagram.setMeasurementUnit(MeasurementUnit.PIXEL_LITERAL);
- return diagram;
- }
-
- /**
- * @generated
- */
- public Edge createEdge(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
- IElementType elementType = getSemanticElementType(semanticAdapter);
- String elementTypeHint = ((IHintedType)elementType).getSemanticHint();
- switch(UMLVisualIDRegistry.getVisualID(elementTypeHint)) {
- case TransitionEditPart.VISUAL_ID:
- return createTransition_7000(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint);
- case GeneralizationEditPart.VISUAL_ID:
- return createGeneralization_19000(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint);
- }
- // can never happen, provided #provides(CreateEdgeViewOperation) is correct
- return null;
- }
-
- /**
- * @generated
- */
- public Node createFinalState_5000(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(FinalStateEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "FinalState");
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "FinalState");
-
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "FinalState");
-
- Node label5001 = createLabel(node, UMLVisualIDRegistry.getType(FinalStateNameEditPart.VISUAL_ID));
- label5001.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- Location location5001 = (Location)label5001.getLayoutConstraint();
- location5001.setX(25);
- location5001.setY(3);
- Node label5002 = createLabel(node, UMLVisualIDRegistry.getType(FinalStateStereotypeEditPart.VISUAL_ID));
- label5002.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- Location location5002 = (Location)label5002.getLayoutConstraint();
- location5002.setX(25);
- location5002.setY(-10);
-
- return node;
- }
-
- /**
- * @generated
- */
- public Edge createGeneralization_19000(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Connector edge = NotationFactory.eINSTANCE.createConnector();
- edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
- RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
- 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(GeneralizationEditPart.VISUAL_ID));
- edge.setElement(domainElement);
- // initializePreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(edge, prefStore, "Generalization");
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "Generalization");
-
- //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, "Generalization");
-
- Node label19002 = createLabel(edge, UMLVisualIDRegistry.getType(GeneralizationStereotypeEditPart.VISUAL_ID));
- label19002.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
- Location location19002 = (Location)label19002.getLayoutConstraint();
- location19002.setX(0);
- location19002.setY(40);
- return edge;
- }
-
- /**
- * @generated
- */
- protected Node createLabel(View owner, String hint) {
- DecorationNode rv = NotationFactory.eINSTANCE.createDecorationNode();
- rv.setType(hint);
- ViewUtil.insertChildView(owner, rv, ViewUtil.APPEND, true);
- return rv;
- }
-
- /**
- * @generated
- */
- public Node createNode(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, 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 StateMachineEditPart.VISUAL_ID:
- return createStateMachine_2000(domainElement, containerView, index, persisted, preferencesHint);
- case RegionEditPart.VISUAL_ID:
- return createRegion_3000(domainElement, containerView, index, persisted, preferencesHint);
- case FinalStateEditPart.VISUAL_ID:
- return createFinalState_5000(domainElement, containerView, index, persisted, preferencesHint);
- case StateEditPart.VISUAL_ID:
- return createState_6000(domainElement, containerView, index, persisted, preferencesHint);
- case PseudostateInitialEditPart.VISUAL_ID:
- return createPseudostate_8000(domainElement, containerView, index, persisted, preferencesHint);
- case PseudostateJoinEditPart.VISUAL_ID:
- return createPseudostate_9000(domainElement, containerView, index, persisted, preferencesHint);
- case PseudostateForkEditPart.VISUAL_ID:
- return createPseudostate_10000(domainElement, containerView, index, persisted, preferencesHint);
- case PseudostateChoiceEditPart.VISUAL_ID:
- return createPseudostate_11000(domainElement, containerView, index, persisted, preferencesHint);
- case PseudostateJunctionEditPart.VISUAL_ID:
- return createPseudostate_12000(domainElement, containerView, index, persisted, preferencesHint);
- case PseudostateShallowHistoryEditPart.VISUAL_ID:
- return createPseudostate_13000(domainElement, containerView, index, persisted, preferencesHint);
- case PseudostateDeepHistoryEditPart.VISUAL_ID:
- return createPseudostate_14000(domainElement, containerView, index, persisted, preferencesHint);
- case PseudostateTerminateEditPart.VISUAL_ID:
- return createPseudostate_15000(domainElement, containerView, index, persisted, preferencesHint);
- case PseudostateEntryPointEditPart.VISUAL_ID:
- return createPseudostate_16000(domainElement, containerView, index, persisted, preferencesHint);
- case PseudostateExitPointEditPart.VISUAL_ID:
- return createPseudostate_17000(domainElement, containerView, index, persisted, preferencesHint);
- case ConnectionPointReferenceEditPart.VISUAL_ID:
- return createConnectionPointReference_18000(domainElement, containerView, index, persisted, preferencesHint);
- }
- // can't happen, provided #provides(CreateNodeViewOperation) is correct
- return null;
- }
-
- /**
- * @generated
- */
- public Node createPseudostate_10000(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(PseudostateForkEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "Pseudostate");
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate");
-
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "Pseudostate");
-
- Node label10001 = createLabel(node, UMLVisualIDRegistry.getType(PseudostateForkNameEditPart.VISUAL_ID));
- label10001.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- Location location10001 = (Location)label10001.getLayoutConstraint();
- location10001.setX(25);
- location10001.setY(3);
- Node label10002 = createLabel(node, UMLVisualIDRegistry.getType(PseudostateForkStereotypeEditPart.VISUAL_ID));
- label10002.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- Location location10002 = (Location)label10002.getLayoutConstraint();
- location10002.setX(25);
- location10002.setY(-10);
-
- return node;
- }
-
- /**
- * @generated
- */
- public Node createPseudostate_11000(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(PseudostateChoiceEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "Pseudostate");
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate");
-
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "Pseudostate");
-
- Node label11001 = createLabel(node, UMLVisualIDRegistry.getType(PseudostateChoiceNameEditPart.VISUAL_ID));
- label11001.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- Location location11001 = (Location)label11001.getLayoutConstraint();
- location11001.setX(25);
- location11001.setY(3);
- Node label11002 = createLabel(node, UMLVisualIDRegistry.getType(PseudostateChoiceStereotypeEditPart.VISUAL_ID));
- label11002.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- Location location11002 = (Location)label11002.getLayoutConstraint();
- location11002.setX(25);
- location11002.setY(-10);
-
- return node;
- }
-
- /**
- * @generated
- */
- public Node createPseudostate_12000(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(PseudostateJunctionEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "Pseudostate");
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate");
-
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "Pseudostate");
-
- Node label12001 = createLabel(node, UMLVisualIDRegistry.getType(PseudostateJunctionNameEditPart.VISUAL_ID));
- label12001.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- Location location12001 = (Location)label12001.getLayoutConstraint();
- location12001.setX(25);
- location12001.setY(3);
- Node label12002 = createLabel(node, UMLVisualIDRegistry.getType(PseudostateJunctionStereotypeEditPart.VISUAL_ID));
- label12002.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- Location location12002 = (Location)label12002.getLayoutConstraint();
- location12002.setX(25);
- location12002.setY(-10);
-
- return node;
- }
-
- /**
- * @generated
- */
- public Node createPseudostate_13000(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(PseudostateShallowHistoryEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "Pseudostate");
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate");
-
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "Pseudostate");
-
- Node label13001 = createLabel(node, UMLVisualIDRegistry.getType(PseudostateShallowHistoryNameEditPart.VISUAL_ID));
- label13001.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- Location location13001 = (Location)label13001.getLayoutConstraint();
- location13001.setX(25);
- location13001.setY(3);
- Node label13002 = createLabel(node, UMLVisualIDRegistry.getType(PseudostateShallowHistoryStereotypeEditPart.VISUAL_ID));
- label13002.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- Location location13002 = (Location)label13002.getLayoutConstraint();
- location13002.setX(25);
- location13002.setY(-10);
-
- return node;
- }
-
- /**
- * @generated
- */
- public Node createPseudostate_14000(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(PseudostateDeepHistoryEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "Pseudostate");
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate");
-
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "Pseudostate");
-
- Node label14001 = createLabel(node, UMLVisualIDRegistry.getType(PseudostateDeepHistoryNameEditPart.VISUAL_ID));
- label14001.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- Location location14001 = (Location)label14001.getLayoutConstraint();
- location14001.setX(25);
- location14001.setY(3);
- Node label14002 = createLabel(node, UMLVisualIDRegistry.getType(PseudostateDeepHistoryStereotypeEditPart.VISUAL_ID));
- label14002.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- Location location14002 = (Location)label14002.getLayoutConstraint();
- location14002.setX(25);
- location14002.setY(-10);
-
- return node;
- }
-
- /**
- * @generated
- */
- public Node createPseudostate_15000(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(PseudostateTerminateEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "Pseudostate");
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate");
-
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "Pseudostate");
-
- Node label15001 = createLabel(node, UMLVisualIDRegistry.getType(PseudostateTerminateNameEditPart.VISUAL_ID));
- label15001.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- Location location15001 = (Location)label15001.getLayoutConstraint();
- location15001.setX(25);
- location15001.setY(3);
- Node label15002 = createLabel(node, UMLVisualIDRegistry.getType(PseudostateTerminateStereotypeEditPart.VISUAL_ID));
- label15002.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- Location location15002 = (Location)label15002.getLayoutConstraint();
- location15002.setX(25);
- location15002.setY(-10);
-
- return node;
- }
-
- /**
- * @generated
- */
- public Node createPseudostate_16000(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(PseudostateEntryPointEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "Pseudostate");
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate");
-
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "Pseudostate");
-
- Node label16001 = createLabel(node, UMLVisualIDRegistry.getType(PseudostateEntryPointNameEditPart.VISUAL_ID));
- label16001.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- Location location16001 = (Location)label16001.getLayoutConstraint();
- location16001.setX(25);
- location16001.setY(3);
- Node label16002 = createLabel(node, UMLVisualIDRegistry.getType(PseudostateEntryPointStereotypeEditPart.VISUAL_ID));
- label16002.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- Location location16002 = (Location)label16002.getLayoutConstraint();
- location16002.setX(25);
- location16002.setY(-10);
-
- return node;
- }
-
- /**
- * @generated
- */
- public Node createPseudostate_17000(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(PseudostateExitPointEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "Pseudostate");
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate");
-
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "Pseudostate");
-
- Node label17001 = createLabel(node, UMLVisualIDRegistry.getType(PseudostateExitPointNameEditPart.VISUAL_ID));
- label17001.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- Location location17001 = (Location)label17001.getLayoutConstraint();
- location17001.setX(25);
- location17001.setY(3);
- Node label17002 = createLabel(node, UMLVisualIDRegistry.getType(PseudostateExitPointStereotypeEditPart.VISUAL_ID));
- label17002.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- Location location17002 = (Location)label17002.getLayoutConstraint();
- location17002.setX(25);
- location17002.setY(-10);
-
- return node;
- }
-
- /**
- * @generated
- */
- public Node createPseudostate_8000(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(PseudostateInitialEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "Pseudostate");
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate");
-
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "Pseudostate");
-
- Node label8001 = createLabel(node, UMLVisualIDRegistry.getType(PseudostateInitialNameEditPart.VISUAL_ID));
- label8001.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- Location location8001 = (Location)label8001.getLayoutConstraint();
- location8001.setX(25);
- location8001.setY(3);
- Node label8002 = createLabel(node, UMLVisualIDRegistry.getType(PseudostateInitialStereotypeEditPart.VISUAL_ID));
- label8002.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- Location location8002 = (Location)label8002.getLayoutConstraint();
- location8002.setX(25);
- location8002.setY(-10);
-
- return node;
- }
-
- /**
- * @generated
- */
- public Node createPseudostate_9000(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(PseudostateJoinEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "Pseudostate");
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Pseudostate");
-
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "Pseudostate");
-
- Node label9001 = createLabel(node, UMLVisualIDRegistry.getType(PseudostateJoinNameEditPart.VISUAL_ID));
- label9001.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- Location location9001 = (Location)label9001.getLayoutConstraint();
- location9001.setX(25);
- location9001.setY(3);
- Node label9002 = createLabel(node, UMLVisualIDRegistry.getType(PseudostateJoinStereotypeEditPart.VISUAL_ID));
- label9002.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
-
- Location location9002 = (Location)label9002.getLayoutConstraint();
- location9002.setX(25);
- location9002.setY(-10);
-
- return node;
- }
-
- /**
- * @generated
- */
- public Node createRegion_3000(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(RegionEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "Region");
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Region");
-
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "Region");
-
- createCompartment(node, UMLVisualIDRegistry.getType(RegionCompartmentEditPart.VISUAL_ID), false, false, false, false);
-
- PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Region");
-
- return node;
- }
-
- /**
- * @generated
- */
- public Node createState_6000(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(StateEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "State");
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "State");
-
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "State");
-
- Node label6001 = createLabel(node, UMLVisualIDRegistry.getType(StateNameEditPart.VISUAL_ID));
- createCompartment(node, UMLVisualIDRegistry.getType(StateCompartmentEditPart.VISUAL_ID), false, false, false, false);
-
- PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "State");
-
- return node;
- }
-
- /**
- * @generated
- */
- public Node createStateMachine_2000(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(StateMachineEditPart.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, "StateMachine");
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "StateMachine");
-
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "StateMachine");
-
- Node label2001 = createLabel(node, UMLVisualIDRegistry.getType(StateMachineNameEditPart.VISUAL_ID));
- createCompartment(node, UMLVisualIDRegistry.getType(StateMachineCompartmentEditPart.VISUAL_ID), false, false, false, false);
-
- PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "StateMachine");
-
- return node;
- }
-
- /**
- * @generated
- */
- public Edge createTransition_7000(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Connector edge = NotationFactory.eINSTANCE.createConnector();
- edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
- RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
- 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(TransitionEditPart.VISUAL_ID));
- edge.setElement(domainElement);
- // initializePreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(edge, prefStore, "Transition");
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "Transition");
-
- //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, "Transition");
-
- Node label7001 = createLabel(edge, UMLVisualIDRegistry.getType(TransitionNameEditPart.VISUAL_ID));
- label7001.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
- Node label7002 = createLabel(edge, UMLVisualIDRegistry.getType(TransitionGuardEditPart.VISUAL_ID));
- label7002.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
- Node label7003 = createLabel(edge, UMLVisualIDRegistry.getType(TransitionStereotypeEditPart.VISUAL_ID));
- label7003.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
- Location location7003 = (Location)label7003.getLayoutConstraint();
- location7003.setX(0);
- location7003.setY(60);
- return edge;
- }
-
- /**
- * @generated
- */
- protected EObject getSemanticElement(IAdaptable semanticAdapter) {
- if(semanticAdapter == null) {
- return null;
- }
- EObject eObject = (EObject)semanticAdapter.getAdapter(EObject.class);
- if(eObject != null) {
- return EMFCoreUtil.resolve(TransactionUtil.getEditingDomain(eObject), eObject);
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected IElementType getSemanticElementType(IAdaptable semanticAdapter) {
- if(semanticAdapter == null) {
- return null;
- }
- return (IElementType)semanticAdapter.getAdapter(IElementType.class);
- }
-
- /**
- * @generated
- */
- private void initBackgroundFromPrefs(View view, final IPreferenceStore store, String elementName) {
- String fillColorConstant = PreferenceConstantHelper.getElementConstant(elementName, PreferenceConstantHelper.COLOR_FILL);
- String gradientColorConstant = PreferenceConstantHelper.getElementConstant(elementName, PreferenceConstantHelper.COLOR_GRADIENT);
- String gradientPolicyConstant = PreferenceConstantHelper.getElementConstant(elementName, PreferenceConstantHelper.GRADIENT_POLICY);
-
- org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor(store, fillColorConstant);
- ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getFillStyle_FillColor(), FigureUtilities.RGBToInteger(fillRGB));
-
- FillStyle fillStyle = (FillStyle)view.getStyle(NotationPackage.Literals.FILL_STYLE);
- fillStyle.setFillColor(FigureUtilities.RGBToInteger(fillRGB).intValue());
-
- ;
- if(store.getBoolean(gradientPolicyConstant)) {
- GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(store.getString(gradientColorConstant));
- fillStyle.setGradient(gradientPreferenceConverter.getGradientData());
- fillStyle.setTransparency(gradientPreferenceConverter.getTransparency());
- }
- }
-
- /**
- * @generated
- */
- private void initFontStyleFromPrefs(View view, final IPreferenceStore store, String elementName) {
- String fontConstant = PreferenceConstantHelper.getElementConstant(elementName, PreferenceConstantHelper.FONT);
- String fontColorConstant = PreferenceConstantHelper.getElementConstant(elementName, PreferenceConstantHelper.COLOR_FONT);
-
- FontStyle viewFontStyle = (FontStyle)view.getStyle(NotationPackage.Literals.FONT_STYLE);
- if(viewFontStyle != null) {
- 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);
-
- org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(store, fontColorConstant);
- viewFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
- }
- }
-
- /**
- * @generated
- */
- private void initForegroundFromPrefs(View view, final IPreferenceStore store, String elementName) {
- String lineColorConstant = PreferenceConstantHelper.getElementConstant(elementName, PreferenceConstantHelper.COLOR_LINE);
- org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(store, lineColorConstant);
- ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLineStyle_LineColor(), FigureUtilities.RGBToInteger(lineRGB));
- }
-
- /**
- * @generated
- */
- protected boolean provides(CreateDiagramViewOperation op) {
- return PackageEditPart.MODEL_ID.equals(op.getSemanticHint()) && UMLVisualIDRegistry.getDiagramVisualID(getSemanticElement(op.getSemanticAdapter())) != -1;
- }
-
- /**
- * @generated
- */
- protected boolean provides(CreateEdgeViewOperation op) {
- IElementType elementType = getSemanticElementType(op.getSemanticAdapter());
- if(!UMLElementTypes.isKnownElementType(elementType) || (!(elementType instanceof IHintedType))) {
- return false; // foreign element type
- }
- 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
- }
- int visualID = UMLVisualIDRegistry.getVisualID(elementTypeHint);
- 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
- */
- protected boolean provides(CreateNodeViewOperation op) {
- if(op.getContainerView() == null) {
- return false;
- }
- IElementType elementType = getSemanticElementType(op.getSemanticAdapter());
- 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(!UMLElementTypes.isKnownElementType(elementType) || (!(elementType instanceof IHintedType))) {
- return false; // foreign element type
- }
- 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(!PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(op.getContainerView()))) {
- return false; // foreign diagram
- }
- switch(visualID) {
- case StateMachineEditPart.VISUAL_ID:
- case RegionEditPart.VISUAL_ID:
- case FinalStateEditPart.VISUAL_ID:
- case StateEditPart.VISUAL_ID:
- case PseudostateInitialEditPart.VISUAL_ID:
- case PseudostateJoinEditPart.VISUAL_ID:
- case PseudostateForkEditPart.VISUAL_ID:
- case PseudostateChoiceEditPart.VISUAL_ID:
- case PseudostateJunctionEditPart.VISUAL_ID:
- case PseudostateShallowHistoryEditPart.VISUAL_ID:
- case PseudostateDeepHistoryEditPart.VISUAL_ID:
- case PseudostateTerminateEditPart.VISUAL_ID:
- case PseudostateEntryPointEditPart.VISUAL_ID:
- case PseudostateExitPointEditPart.VISUAL_ID:
- case ConnectionPointReferenceEditPart.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 StateMachineEditPart.VISUAL_ID == visualID || RegionEditPart.VISUAL_ID == visualID || FinalStateEditPart.VISUAL_ID == visualID || StateEditPart.VISUAL_ID == visualID || PseudostateInitialEditPart.VISUAL_ID == visualID || PseudostateJoinEditPart.VISUAL_ID == visualID || PseudostateForkEditPart.VISUAL_ID == visualID || PseudostateChoiceEditPart.VISUAL_ID == visualID || PseudostateJunctionEditPart.VISUAL_ID == visualID || PseudostateShallowHistoryEditPart.VISUAL_ID == visualID || PseudostateDeepHistoryEditPart.VISUAL_ID == visualID || PseudostateTerminateEditPart.VISUAL_ID == visualID || PseudostateEntryPointEditPart.VISUAL_ID == visualID || PseudostateExitPointEditPart.VISUAL_ID == visualID || ConnectionPointReferenceEditPart.VISUAL_ID == visualID;
- }
-
- /**
- * @generated
- */
- protected boolean provides(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;
- */
- return true;
- }
-
- /**
- * @generated
- */
- public final boolean provides(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 void stampShortcut(View containerView, Node target) {
- if(!PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
- EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
- shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
- shortcutAnnotation.getDetails().put("modelID", PackageEditPart.MODEL_ID); //$NON-NLS-1$
- target.getEAnnotations().add(shortcutAnnotation);
- }
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/sheet/UMLPropertySection.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/sheet/UMLPropertySection.java
deleted file mode 100644
index b2c36b540ff..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/sheet/UMLPropertySection.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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
- */
-public class UMLPropertySection extends AdvancedPropertySection implements IPropertySourceProvider {
-
- /**
- * @generated
- */
- protected AdapterFactory getAdapterFactory(Object object) {
- if(getEditingDomain() instanceof AdapterFactoryEditingDomain) {
- return ((AdapterFactoryEditingDomain)getEditingDomain()).getAdapterFactory();
- }
- TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(object);
- if(editingDomain != null) {
- return ((AdapterFactoryEditingDomain)editingDomain).getAdapterFactory();
- }
- return null;
- }
-
- /**
- * @generated
- */
- public IPropertySource getPropertySource(Object object) {
- if(object instanceof IPropertySource) {
- return (IPropertySource)object;
- }
- AdapterFactory af = getAdapterFactory(object);
- if(af != null) {
- 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
- */
- protected IPropertySourceProvider getPropertySourceProvider() {
- return this;
- }
-
- /**
- * @generated
- */
- public void setInput(IWorkbenchPart part, ISelection selection) {
- if(selection.isEmpty() || false == selection instanceof StructuredSelection) {
- super.setInput(part, selection);
- return;
- }
- final StructuredSelection structuredSelection = ((StructuredSelection)selection);
- ArrayList transformedSelection = new ArrayList(structuredSelection.size());
- for(Iterator it = structuredSelection.iterator(); it.hasNext();) {
- Object r = transformSelection(it.next());
- if(r != null) {
- transformedSelection.add(r);
- }
- }
- super.setInput(part, new StructuredSelection(transformedSelection));
- }
-
- /**
- * Modify/unwrap selection.
- *
- * @generated
- */
- protected Object transformSelection(Object selected) {
-
- if(selected instanceof EditPart) {
- 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) {
- View view = (View)((IAdaptable)selected).getAdapter(View.class);
- if(view != null) {
- return view.getElement();
- }
- }
- return selected;
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/sheet/UMLSheetLabelProvider.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/sheet/UMLSheetLabelProvider.java
deleted file mode 100644
index 50b638abaca..00000000000
--- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/src/org/eclipse/papyrus/diagram/statemachine/sheet/UMLSheetLabelProvider.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.eclipse.papyrus.diagram.statemachine.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.diagram.statemachine.navigator.UMLNavigatorGroup;
-import org.eclipse.papyrus.diagram.statemachine.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.diagram.statemachine.providers.UMLElementTypes;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @generated
- */
-public class UMLSheetLabelProvider extends BaseLabelProvider implements ILabelProvider {
-
- /**
- * @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) {
- int vid = UMLVisualIDRegistry.getVisualID(view);
- IElementType etype = UMLElementTypes.getElementType(vid);
- if(etype != null) {
- return etype;
- }
- view = view.eContainer() instanceof View ? (View)view.eContainer() : null;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public Image getImage(Object element) {
- IElementType etype = getElementType(getView(unwrap(element)));
- return etype == null ? null : UMLElementTypes.getImage(etype);
- }
-
- /**
- * @generated
- */
- public String getText(Object element) {
- element = unwrap(element);
- if(element instanceof UMLNavigatorGroup) {
- return ((UMLNavigatorGroup)element).getGroupName();
- }
- IElementType etype = getElementType(getView(element));
- return etype == null ? "" : etype.getDisplayName();
- }
-
- /**
- * @generated
- */
- private View getView(Object element) {
- if(element instanceof View) {
- return (View)element;
- }
- if(element instanceof IAdaptable) {
- return (View)((IAdaptable)element).getAdapter(View.class);
- }
- return null;
- }
-
- /**
- * @generated
- */
- private Object unwrap(Object element) {
- if(element instanceof IStructuredSelection) {
- return ((IStructuredSelection)element).getFirstElement();
- }
- return element;
- }
-
-}

Back to the top