Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratischenko2015-05-21 19:54:51 +0000
committerRemi Schnekenburger2015-05-26 10:07:36 +0000
commit1d0b8fcc8683dc3e8d2664c77a64a30d1399790d (patch)
tree2f8e0663dedbbfb85bdc776db4263237fc2cc493 /plugins
parent0de147d052c2e50ce418984e945037e85ecd2009 (diff)
downloadorg.eclipse.papyrus-1d0b8fcc8683dc3e8d2664c77a64a30d1399790d.tar.gz
org.eclipse.papyrus-1d0b8fcc8683dc3e8d2664c77a64a30d1399790d.tar.xz
org.eclipse.papyrus-1d0b8fcc8683dc3e8d2664c77a64a30d1399790d.zip
Migrate DeploymentD to elementtypes fw
- set define externally true in gmfgen - regenerate - fix compilation problems - add elementtypesconfiguration file - mark failing tests Change-Id: I57b6ea32d0316c0428b078f8924c8e712689213d Signed-off-by: atischenko <tischenko@montages.com> Reviewed-on: https://git.eclipse.org/r/48399 Tested-by: Hudson CI Reviewed-by: Remi Schnekenburger <remi.schnekenburger@cea.fr>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/.options14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF155
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/command/BranchDependenctReorientCommand.java80
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/itemsemantic/CustomDefaultNamedElementItemSemanticEditPolicy.java24
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/itemsemantic/CustomDependencyBranchSemanticEditPolicy.java19
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram-notation.elementtypesconfigurations6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.elementtypesconfigurations374
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.gmfgen6316
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml535
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ArtifactCreateCommand.java127
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ArtifactCreateCommandACN.java126
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ArtifactCreateCommandCN.java127
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentAnnotatedElementCreateCommand.java108
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentAnnotatedElementReorientCommand.java165
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentCreateCommand.java127
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentCreateCommandCN.java127
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintConstrainedElementCreateCommand.java108
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintConstrainedElementReorientCommand.java165
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintCreateCommand.java131
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintCreateCommandCN.java127
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DefaultNamedElementCreateCommand.java98
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyBranchCreateCommand.java171
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyBranchReorientCommand.java187
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyCreateCommand.java171
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyNodeCreateCommand.java125
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyReorientCommand.java187
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeploymentCreateCommand.java171
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeploymentReorientCommand.java187
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeviceCreateCommand.java127
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeviceCreateCommandCN.java127
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ExecutionEnvironmentCreateCommand.java127
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ExecutionEnvironmentCreateCommandCN.java127
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/GeneralizationCreateCommand.java170
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/GeneralizationReorientCommand.java174
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ManifestationCreateCommand.java171
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ManifestationReorientCommand.java187
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ModelCreateCommand.java127
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ModelCreateCommandCN.java127
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedArtifactNodeCreateCommandCN.java127
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedDeviceCreateCommandCN.java127
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedExecutionEnvironmentCreateCommandCN.java127
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedNodeCreateCommandCN.java127
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NodeCreateCommand.java127
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NodeCreateCommandCN.java126
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/PackageCreateCommand.java126
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/PackageCreateCommandCN.java126
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/ArtifactEditHelper.java20
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/CommentEditHelper.java20
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/ConstraintEditHelper.java20
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/DefaultNamedElementEditHelper.java20
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/DependencyEditHelper.java20
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/DeploymentEditHelper.java20
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/DeviceEditHelper.java20
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/ExecutionEnvironmentEditHelper.java20
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/GeneralizationEditHelper.java20
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/ManifestationEditHelper.java20
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/ModelEditHelper.java20
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/NodeEditHelper.java20
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/UMLBaseEditHelper.java40
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPart.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPartACN.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPartCN.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPart.java726
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPartACN.java726
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPartCN.java726
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPart.java1706
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPartACN.java1706
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPartCN.java1706
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPart.java1727
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPartACN.java1727
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPartCN.java1727
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentAnnotatedElementEditPart.java136
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentBodyEditPart.java1727
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentBodyEditPartCN.java1727
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentEditPart.java568
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentEditPartCN.java568
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintConstrainedElementEditPart.java136
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintEditPart.java578
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintEditPartCN.java578
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintNameEditPart.java1727
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintNameEditPartCN.java1727
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintSpecificationEditPart.java1727
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintSpecificationEditPartCN.java1727
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DefaultNamedElementEditPart.java574
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DefaultNamedElementNameEditPart.java1761
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyAppliedStereotypeEditPart.java1646
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyBranchEditPart.java142
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyEditPart.java253
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyNameEditPart.java1646
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyNodeEditPart.java490
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentAppliedStereotypeEditPart.java1646
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentDiagramEditPart.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentEditPart.java247
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentNameEditPart.java1646
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceCompositeCompartmentEditPart.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceCompositeCompartmentEditPartCN.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceEditPart.java614
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceEditPartCN.java584
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceNameEditPart.java1727
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceNameEditPartCN.java1727
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentCompositeCompartmentEditPart.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentCompositeCompartmentEditPartCN.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentEditPart.java614
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentEditPartCN.java584
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentNameEditPart.java1727
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentNameEditPartCN.java1727
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/GeneralizationAppliedStereotypeEditPart.java1630
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/GeneralizationEditPart.java233
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/LinkDescriptorEditPart.java140
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationAppliedStereotypeEditPart.java1646
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationEditPart.java247
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationNameEditPart.java1646
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelEditPart.java602
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelEditPartCN.java602
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelNameEditPart.java1761
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelNameEditPartCN.java1761
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelPackageableElementCompartmentEditPart.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelPackageableElementCompartmentEditPartCN.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/MultiDependencyLabelEditPart.java1690
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedArtifactNameEditPart.java1727
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedArtifactNodeEditPartCN.java556
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedDeviceEditPartCN.java590
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedDeviceNameEditPartCN.java1727
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedExecutionEnvironmentEditPartCN.java590
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedExecutionEnvironmentNameEditPartCN.java1727
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedNodeEditPartCN.java588
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedNodeNameEditPart.java1727
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeCompositeCompartmentEditPart.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeCompositeCompartmentEditPartCN.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeEditPart.java612
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeEditPartCN.java582
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeNameEditPart.java1727
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeNameEditPartCN.java1727
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageEditPart.java600
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageEditPartCN.java602
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageNameEditPart.java1761
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageNameEditPartCN.java1761
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackagePackageableElementCompartmentEditPart.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackagePackageableElementCompartmentEditPartCN.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/UMLEditPartFactory.java717
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentCanonicalEditPolicy.java176
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentCanonicalEditPolicyACN.java176
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentCanonicalEditPolicyCN.java176
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentItemSemanticEditPolicy.java51
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentItemSemanticEditPolicyACN.java51
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentItemSemanticEditPolicyCN.java51
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactItemSemanticEditPolicy.java266
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactItemSemanticEditPolicyACN.java339
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactItemSemanticEditPolicyCN.java339
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/CommentAnnotatedElementItemSemanticEditPolicy.java38
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/CommentItemSemanticEditPolicy.java161
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/CommentItemSemanticEditPolicyCN.java169
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ConstraintConstrainedElementItemSemanticEditPolicy.java38
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ConstraintItemSemanticEditPolicy.java253
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ConstraintItemSemanticEditPolicyCN.java265
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DefaultNamedElementItemSemanticEditPolicy.java261
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DependencyBranchItemSemanticEditPolicy.java249
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DependencyItemSemanticEditPolicy.java249
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DependencyNodeItemSemanticEditPolicy.java249
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeploymentDiagramItemSemanticEditPolicy.java131
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeploymentItemSemanticEditPolicy.java249
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentCanonicalEditPolicy.java179
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentCanonicalEditPolicyCN.java179
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentItemSemanticEditPolicy.java63
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentItemSemanticEditPolicyCN.java63
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceItemSemanticEditPolicy.java266
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceItemSemanticEditPolicyCN.java278
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicy.java190
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicyCN.java190
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicy.java57
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicyCN.java57
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentItemSemanticEditPolicy.java266
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentItemSemanticEditPolicyCN.java278
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/GeneralizationItemSemanticEditPolicy.java154
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ManifestationItemSemanticEditPolicy.java249
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelCanonicalEditPolicy.java639
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelItemSemanticEditPolicy.java535
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelItemSemanticEditPolicyCN.java535
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicy.java208
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicyCN.java208
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicy.java93
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyCN.java93
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedArtifactNodeItemSemanticEditPolicyCN.java278
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedDeviceItemSemanticEditPolicyCN.java403
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedExecutionEnvironmentItemSemanticEditPolicyCN.java371
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedNodeItemSemanticEditPolicyCN.java435
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentCanonicalEditPolicy.java199
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentCanonicalEditPolicyCN.java199
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentItemSemanticEditPolicy.java69
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentItemSemanticEditPolicyCN.java69
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeItemSemanticEditPolicy.java266
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeItemSemanticEditPolicyCN.java278
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackageItemSemanticEditPolicy.java249
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackageItemSemanticEditPolicyCN.java249
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicy.java208
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicyCN.java206
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java93
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicyCN.java87
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLBaseItemSemanticEditPolicy.java1088
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLTextNonResizableEditPolicy.java487
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLTextSelectionEditPolicy.java452
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/expressions/UMLAbstractExpression.java340
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/expressions/UMLOCLFactory.java367
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/parsers/AbstractParser.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/parsers/MessageFormatParser.java424
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/DiagramEditorContextMenuProvider.java124
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/LoadResourceAction.java60
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/Messages.java998
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/ModelElementSelectionPage.java78
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLCreationWizard.java359
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLCreationWizardPage.java196
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramActionBarContributor.java122
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditor.java1099
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditorPlugin.java603
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditorUtil.java722
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramUpdater.java5532
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDocumentProvider.java2066
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLInitDiagramFileAction.java212
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLLinkDescriptor.java72
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLMatchingStrategy.java90
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLNewDiagramFileWizard.java387
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLNodeDescriptor.java56
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLPaletteFactory.java646
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLVisualIDRegistry.java1994
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/ValidateAction.java594
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramAppearancePreferencePage.java56
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramConnectionsPreferencePage.java56
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramGeneralPreferencePage.java60
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramPreferenceInitializer.java96
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramPrintingPreferencePage.java56
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramRulersAndGridPreferencePage.java56
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/ElementInitializers.java1339
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLEditPartProvider.java64
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLElementTypes.java1086
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLIconProvider.java56
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLMarkerNavigationProvider.java192
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLParserProvider.java1747
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLValidationDecoratorProvider.java146
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLValidationProvider.java152
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLViewProvider.java2540
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/sheet/UMLPropertySection.java64
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/sheet/UMLSheetLabelProvider.java174
242 files changed, 55155 insertions, 73551 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/.options b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/.options
index d46c2109fee..e88b9d08501 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/.options
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/.options
@@ -1,7 +1,7 @@
-# Tracing options for the org.eclipse.papyrus.uml.diagram.deployment plug-in
-
-# Common issues
-org.eclipse.papyrus.uml.diagram.deployment/debug=false
-
-# Visual IDs
-org.eclipse.papyrus.uml.diagram.deployment/debug/visualID=false
+# Tracing options for the org.eclipse.papyrus.uml.diagram.deployment plug-in
+
+# Common issues
+org.eclipse.papyrus.uml.diagram.deployment/debug=false
+
+# Visual IDs
+org.eclipse.papyrus.uml.diagram.deployment/debug/visualID=false
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF
index 3ff4147cf1e..1f540403447 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF
@@ -1,78 +1,77 @@
-Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.uml.diagram.deployment,
- org.eclipse.papyrus.uml.diagram.deployment.custom.actions,
- org.eclipse.papyrus.uml.diagram.deployment.custom.edit.command,
- org.eclipse.papyrus.uml.diagram.deployment.custom.edit.helpers,
- org.eclipse.papyrus.uml.diagram.deployment.custom.edit.part,
- org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies,
- org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.itemsemantic,
- org.eclipse.papyrus.uml.diagram.deployment.custom.factory,
- org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes,
- org.eclipse.papyrus.uml.diagram.deployment.custom.messages,
- org.eclipse.papyrus.uml.diagram.deployment.custom.providers,
- org.eclipse.papyrus.uml.diagram.deployment.edit.commands,
- org.eclipse.papyrus.uml.diagram.deployment.edit.helpers,
- org.eclipse.papyrus.uml.diagram.deployment.edit.parts,
- org.eclipse.papyrus.uml.diagram.deployment.edit.policies,
- org.eclipse.papyrus.uml.diagram.deployment.expressions,
- org.eclipse.papyrus.uml.diagram.deployment.parsers,
- org.eclipse.papyrus.uml.diagram.deployment.part,
- org.eclipse.papyrus.uml.diagram.deployment.preferences,
- org.eclipse.papyrus.uml.diagram.deployment.providers,
- org.eclipse.papyrus.uml.diagram.deployment.sheet
-Bundle-ActivationPolicy: lazy
-Bundle-ClassPath: .
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.properties,
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide,
- org.eclipse.ocl.ecore,
- org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="1.1.0",
- org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.services.edit;bundle-version="1.1.0",
- org.eclipse.papyrus.uml.diagram.common;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.core;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.1.0",
- org.eclipse.ui.ide;bundle-version="3.8.0",
- org.eclipse.papyrus.infra.extendedtypes;bundle-version="1.1.0",
- org.eclipse.uml2.uml.edit;bundle-version="4.0.0",
- org.eclipse.gmf.tooling.runtime;bundle-version="3.0.0",
- org.eclipse.papyrus.infra.widgets;bundle-version="1.1.0",
- org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="1.7.0",
- org.eclipse.core.runtime,
- org.eclipse.core.resources,
- org.eclipse.jface,
- 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.papyrus.uml.service.types;bundle-version="1.1.0",
- 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.draw2d,
- org.eclipse.gmf.runtime.draw2d.ui,
- org.eclipse.uml2.uml,
- org.eclipse.emf.ecore,
- org.eclipse.emf.ecore.edit,
- org.eclipse.emf.validation,
- org.eclipse.gef,
- org.eclipse.papyrus.infra.emf.appearance;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.1.0",
- org.eclipse.papyrus.uml.tools.utils;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.core.log;bundle-version="1.1.0",
- org.eclipse.core.databinding.observable
-Bundle-Vendor: %providerName
-Eclipse-LazyStart: true
-Bundle-Version: 1.1.0.qualifier
-Bundle-Activator: org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.deployment; singleton:=true
+Manifest-Version: 1.0
+Export-Package: org.eclipse.papyrus.uml.diagram.deployment,
+ org.eclipse.papyrus.uml.diagram.deployment.custom.actions,
+ org.eclipse.papyrus.uml.diagram.deployment.custom.edit.command,
+ org.eclipse.papyrus.uml.diagram.deployment.custom.edit.helpers,
+ org.eclipse.papyrus.uml.diagram.deployment.custom.edit.part,
+ org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies,
+ org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.itemsemantic,
+ org.eclipse.papyrus.uml.diagram.deployment.custom.factory,
+ org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes,
+ org.eclipse.papyrus.uml.diagram.deployment.custom.messages,
+ org.eclipse.papyrus.uml.diagram.deployment.custom.providers,
+ org.eclipse.papyrus.uml.diagram.deployment.edit.helpers,
+ org.eclipse.papyrus.uml.diagram.deployment.edit.parts,
+ org.eclipse.papyrus.uml.diagram.deployment.edit.policies,
+ org.eclipse.papyrus.uml.diagram.deployment.expressions,
+ org.eclipse.papyrus.uml.diagram.deployment.parsers,
+ org.eclipse.papyrus.uml.diagram.deployment.part,
+ org.eclipse.papyrus.uml.diagram.deployment.preferences,
+ org.eclipse.papyrus.uml.diagram.deployment.providers,
+ org.eclipse.papyrus.uml.diagram.deployment.sheet
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.properties,
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide,
+ org.eclipse.ocl.ecore,
+ org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="1.1.0",
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.services.edit;bundle-version="1.1.0",
+ org.eclipse.papyrus.uml.diagram.common;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.1.0",
+ org.eclipse.ui.ide;bundle-version="3.8.0",
+ org.eclipse.papyrus.infra.extendedtypes;bundle-version="1.1.0",
+ org.eclipse.uml2.uml.edit;bundle-version="4.0.0",
+ org.eclipse.gmf.tooling.runtime;bundle-version="3.0.0",
+ org.eclipse.papyrus.infra.widgets;bundle-version="1.1.0",
+ org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="1.7.0",
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.jface,
+ 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.papyrus.uml.service.types;bundle-version="1.1.0",
+ 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.draw2d,
+ org.eclipse.gmf.runtime.draw2d.ui,
+ org.eclipse.uml2.uml,
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.ecore.edit,
+ org.eclipse.emf.validation,
+ org.eclipse.gef,
+ org.eclipse.papyrus.infra.emf.appearance;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.1.0",
+ org.eclipse.papyrus.uml.tools.utils;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.1.0",
+ org.eclipse.core.databinding.observable
+Bundle-Vendor: %providerName
+Eclipse-LazyStart: true
+Bundle-Version: 1.1.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.deployment; singleton:=true
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/command/BranchDependenctReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/command/BranchDependenctReorientCommand.java
index e4902e35c62..f5b2526a2bb 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/command/BranchDependenctReorientCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/command/BranchDependenctReorientCommand.java
@@ -14,30 +14,51 @@
package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.command;
+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.uml.diagram.deployment.edit.commands.DependencyBranchReorientCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.uml2.uml.Dependency;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Package;
-
+import org.eclipse.core.commands.ExecutionException;
/**
* because of the nature of this relation the test about can execute has to be change
*
*/
-public class BranchDependenctReorientCommand extends DependencyBranchReorientCommand {
+public class BranchDependenctReorientCommand extends EditElementCommand {
private EObject oldNamedElementEnd;
private EObject newNamedElementEnd;
+ private final int reorientDirection;
+
public BranchDependenctReorientCommand(ReorientRelationshipRequest request) {
- super(request);
+ super(request.getLabel(), request.getRelationship(), request);
+ reorientDirection = request.getDirection();
oldNamedElementEnd = request.getOldRelationshipEnd();
newNamedElementEnd = request.getNewRelationshipEnd();
}
@Override
+ public boolean canExecute() {
+ if (false == getElementToEdit() instanceof Dependency) {
+ return false;
+ }
+ if (reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
protected boolean canReorientSource() {
if (!(oldNamedElementEnd instanceof NamedElement && newNamedElementEnd instanceof NamedElement)) {
return false;
@@ -55,7 +76,6 @@ public class BranchDependenctReorientCommand extends DependencyBranchReorientCom
}
- @Override
protected boolean canReorientTarget() {
if (!(oldNamedElementEnd instanceof NamedElement && newNamedElementEnd instanceof NamedElement)) {
return false;
@@ -72,4 +92,54 @@ public class BranchDependenctReorientCommand extends DependencyBranchReorientCom
return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistDependency_4010(container, getLink(), source, getNewTarget());
}
+
+ protected CommandResult reorientSource() throws ExecutionException {
+ getLink().getClients()
+ .remove(getOldSource());
+ getLink().getClients()
+ .add(getNewSource());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getLink().getSuppliers()
+ .remove(getOldTarget());
+ getLink().getSuppliers()
+ .add(getNewTarget());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ @Override
+ 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 == ReorientRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ protected Dependency getLink() {
+ return (Dependency) getElementToEdit();
+ }
+
+ protected NamedElement getOldSource() {
+ return (NamedElement) oldNamedElementEnd;
+ }
+
+ protected NamedElement getNewSource() {
+ return (NamedElement) newNamedElementEnd;
+ }
+
+ protected NamedElement getOldTarget() {
+ return (NamedElement) oldNamedElementEnd;
+ }
+
+ protected NamedElement getNewTarget() {
+ return (NamedElement) newNamedElementEnd;
+ }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/itemsemantic/CustomDefaultNamedElementItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/itemsemantic/CustomDefaultNamedElementItemSemanticEditPolicy.java
index 08a57038d0b..c515f90a556 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/itemsemantic/CustomDefaultNamedElementItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/itemsemantic/CustomDefaultNamedElementItemSemanticEditPolicy.java
@@ -14,23 +14,33 @@
package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.itemsemantic;
import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.commands.wrappers.GMFtoGEFCommandWrapper;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.command.BranchDependenctReorientCommand;
import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.DefaultNamedElementItemSemanticEditPolicy;
/**
* this class has been specialized in order to manage reconnection of multidependency
*
*/
-public class CustomDefaultNamedElementItemSemanticEditPolicy extends DefaultNamedElementItemSemanticEditPolicy {
+public class CustomDefaultNamedElementItemSemanticEditPolicy extends DefaultSemanticEditPolicy {
+
+ public static final String VISUAL_ID_KEY = "visual_id";
@Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DependencyBranchEditPart.VISUAL_ID:
- return getGEFWrapper(new BranchDependenctReorientCommand(req));
+ protected Command getSemanticCommand(IEditCommandRequest request) {
+ if (request instanceof ReorientRelationshipRequest) {
+ if (DependencyBranchEditPart.VISUAL_ID == getVisualID(request)) {
+ return new GMFtoGEFCommandWrapper(new BranchDependenctReorientCommand((ReorientRelationshipRequest)request));
+ }
}
- return super.getReorientRelationshipCommand(req);
+ return super.getSemanticCommand(request);
+ }
+
+ 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/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/itemsemantic/CustomDependencyBranchSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/itemsemantic/CustomDependencyBranchSemanticEditPolicy.java
index e6dd796a8d8..eba8d8e123a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/itemsemantic/CustomDependencyBranchSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/edit/policies/itemsemantic/CustomDependencyBranchSemanticEditPolicy.java
@@ -14,8 +14,10 @@ package org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.itemsema
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.DependencyBranchItemSemanticEditPolicy;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
@@ -23,16 +25,17 @@ import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
* this class is used to forbid the creation of a dependency branch on a dependency branch.
*
*/
-public class CustomDependencyBranchSemanticEditPolicy extends DependencyBranchItemSemanticEditPolicy {
+public class CustomDependencyBranchSemanticEditPolicy extends DefaultSemanticEditPolicy {
@Override
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
-
- if (UMLElementTypes.Dependency_4010 == req.getElementType()) {
- return UnexecutableCommand.INSTANCE;
+ protected Command getSemanticCommand(IEditCommandRequest request) {
+ if (request instanceof CreateRelationshipRequest) {
+ IElementType type = ((CreateRelationshipRequest) request).getElementType();
+ if (UMLElementTypes.Dependency_4010 == type) {
+ return UnexecutableCommand.INSTANCE;
+ }
}
-
- return super.getStartCreateRelationshipCommand(req);
+ return super.getSemanticCommand(request);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram-notation.elementtypesconfigurations b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram-notation.elementtypesconfigurations
new file mode 100644
index 00000000000..d24aef12af7
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram-notation.elementtypesconfigurations
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="ASCII"?>
+<elementtypesconfigurations:ElementTypeSetConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:elementtypesconfigurations="http://www.eclipse.org/papyrus/infra/elementtypesconfigurations/1.0" xmi:id="_rcmpgv_cEeS2GcUTq58BKg" metamodelNsURI="http://www.eclipse.org/gmf/runtime/1.0.2/notation">
+ <elementTypeConfigurations xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration" xmi:id="_rcnQkP_cEeS2GcUTq58BKg" name="Undefined" identifier="org.eclipse.papyrus.uml.diagram.deployment.Link_4005" hint="4005" kind="org.eclipse.gmf.runtime.diagram.ui.util.INotationType">
+ <specializedTypesID>org.eclipse.gmf.runtime.emf.type.core.null</specializedTypesID>
+ </elementTypeConfigurations>
+</elementtypesconfigurations:ElementTypeSetConfiguration>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.elementtypesconfigurations b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.elementtypesconfigurations
new file mode 100644
index 00000000000..ad1ba9da63a
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.elementtypesconfigurations
@@ -0,0 +1,374 @@
+<?xml version="1.0" encoding="ASCII"?>
+<elementtypesconfigurations:ElementTypeSetConfiguration
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:elementtypesconfigurations="http://www.eclipse.org/papyrus/infra/elementtypesconfigurations/1.0"
+ xmi:id="_gvIwYP8PEeS2nvlxgM4H8g"
+ name="PapyrusUMLDeploymentDiagram"
+ metamodelNsURI="http://www.eclipse.org/uml2/5.0.0/UML">
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gwBhMP8PEeS2nvlxgM4H8g"
+ name="Artifact"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.Artifact_25"
+ hint="25">
+ <iconEntry
+ xmi:id="_gwBhMf8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/Artifact.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Artifact</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gwCIQP8PEeS2nvlxgM4H8g"
+ name="Artifact"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.Artifact_28"
+ hint="28">
+ <iconEntry
+ xmi:id="_gwCIQf8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/Artifact.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Artifact</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gwCIQv8PEeS2nvlxgM4H8g"
+ name="Artifact"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.Artifact_40"
+ hint="40">
+ <iconEntry
+ xmi:id="_gwCIQ_8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/Artifact.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Artifact</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gwGZsv8PEeS2nvlxgM4H8g"
+ name="Artifact"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.Artifact_2006"
+ hint="2006">
+ <iconEntry
+ xmi:id="_gwGZs_8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/Artifact.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Artifact</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gwCvUP8PEeS2nvlxgM4H8g"
+ name="Comment"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.Comment_54"
+ hint="54">
+ <iconEntry
+ xmi:id="_gwCvUf8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/Comment.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Comment</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gwFLkv8PEeS2nvlxgM4H8g"
+ name="Comment"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.Comment_2001"
+ hint="2001">
+ <iconEntry
+ xmi:id="_gwFLk_8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/Comment.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Comment</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gwHn0P8PEeS2nvlxgM4H8g"
+ name="Comment Annotated Element"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.CommentAnnotatedElement_4006"
+ hint="4008">
+ <specializedTypesID>org.eclipse.papyrus.uml.Comment.AnnotatedElements</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gwDWYP8PEeS2nvlxgM4H8g"
+ name="Constraint"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.Constraint_56"
+ hint="56">
+ <iconEntry
+ xmi:id="_gwDWYf8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/Constraint.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Constraint</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gwFLkP8PEeS2nvlxgM4H8g"
+ name="Constraint"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.Constraint_2005"
+ hint="2005">
+ <iconEntry
+ xmi:id="_gwFLkf8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/Constraint.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Constraint</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gwHn0f8PEeS2nvlxgM4H8g"
+ name="Constraint Constrained Element"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.ConstraintConstrainedElement_4007"
+ hint="4009">
+ <specializedTypesID>org.eclipse.papyrus.uml.Constraint.ConstrainedElements</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gwHAwv8PEeS2nvlxgM4H8g"
+ name="Default Named Element"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.NamedElement_2012"
+ hint="2012">
+ <iconEntry
+ xmi:id="_gwHAw_8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/NamedElement.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.NamedElement</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gwI18v8PEeS2nvlxgM4H8g"
+ name="Dependency Branch Link"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.Dependency_4010"
+ hint="4010">
+ <iconEntry
+ xmi:id="_gwI18_8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/Dependency.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Dependency</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gwI18P8PEeS2nvlxgM4H8g"
+ name="Dependency Link"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.Dependency_4004"
+ hint="4004">
+ <iconEntry
+ xmi:id="_gwI18f8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/Dependency.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Dependency</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gwD9cP8PEeS2nvlxgM4H8g"
+ name="Dependency Node"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.Dependency_2011"
+ hint="2011">
+ <iconEntry
+ xmi:id="_gwD9cf8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/Dependency.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Dependency</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gwHn0v8PEeS2nvlxgM4H8g"
+ name="Deployment"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.Deployment_4001"
+ hint="4001">
+ <iconEntry
+ xmi:id="_gwHn0_8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/Deployment.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Deployment</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gv-d4P8PEeS2nvlxgM4H8g"
+ name="Device"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.Device_16"
+ hint="16">
+ <iconEntry
+ xmi:id="_gv-d4f8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/Device.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Device</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gv_E8P8PEeS2nvlxgM4H8g"
+ name="Device"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.Device_44"
+ hint="44">
+ <iconEntry
+ xmi:id="_gv_E8f8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/Device.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Device</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gwGZsP8PEeS2nvlxgM4H8g"
+ name="Device"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.Device_2003"
+ hint="2003">
+ <iconEntry
+ xmi:id="_gwGZsf8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/Device.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Device</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gv_sAP8PEeS2nvlxgM4H8g"
+ name="Execution Environment"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_21"
+ hint="21">
+ <iconEntry
+ xmi:id="_gv_sAf8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/ExecutionEnvironment.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.ExecutionEnvironment</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gv_sAv8PEeS2nvlxgM4H8g"
+ name="Execution Environment"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_46"
+ hint="46">
+ <iconEntry
+ xmi:id="_gv_sA_8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/ExecutionEnvironment.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.ExecutionEnvironment</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gwFyoP8PEeS2nvlxgM4H8g"
+ name="Execution Environment"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_2002"
+ hint="2002">
+ <iconEntry
+ xmi:id="_gwFyof8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/ExecutionEnvironment.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.ExecutionEnvironment</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gwIO4P8PEeS2nvlxgM4H8g"
+ name="Generalization"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.Generalization_4003"
+ hint="4003">
+ <iconEntry
+ xmi:id="_gwIO4f8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/Generalization.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Generalization</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gwHn1P8PEeS2nvlxgM4H8g"
+ name="Manifestation"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.Manifestation_4002"
+ hint="4002">
+ <iconEntry
+ xmi:id="_gwHn1f8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/Manifestation.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Manifestation</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gv9PwP8PEeS2nvlxgM4H8g"
+ name="Model"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.Model_49"
+ hint="49">
+ <iconEntry
+ xmi:id="_gv9Pwf8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/Model.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Model</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gwD9cv8PEeS2nvlxgM4H8g"
+ name="Model"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.Model_2010"
+ hint="2010">
+ <iconEntry
+ xmi:id="_gwD9c_8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/Model.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Model</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gwATEP8PEeS2nvlxgM4H8g"
+ name="Node"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.Node_23"
+ hint="23">
+ <iconEntry
+ xmi:id="_gwATEf8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/Node.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Node</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gwA6IP8PEeS2nvlxgM4H8g"
+ name="Node"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.Node_42"
+ hint="42">
+ <iconEntry
+ xmi:id="_gwA6If8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/Node.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Node</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gwHAwP8PEeS2nvlxgM4H8g"
+ name="Node"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.Node_2008"
+ hint="2008">
+ <iconEntry
+ xmi:id="_gwHAwf8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/Node.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Node</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gv0s4P8PEeS2nvlxgM4H8g"
+ name="Package"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.Package_1000"
+ hint="PapyrusUMLDeploymentDiagram">
+ <iconEntry
+ xmi:id="_gv0s4f8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/Package.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Package</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gv920P8PEeS2nvlxgM4H8g"
+ name="Package"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.Package_36"
+ hint="36">
+ <iconEntry
+ xmi:id="_gv920f8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/Package.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Package</specializedTypesID>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_gwEkgP8PEeS2nvlxgM4H8g"
+ name="Package"
+ identifier="org.eclipse.papyrus.uml.diagram.deployment.Package_2009"
+ hint="2009">
+ <iconEntry
+ xmi:id="_gwEkgf8PEeS2nvlxgM4H8g"
+ iconPath="/icons/full/obj16/Package.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.uml.Package</specializedTypesID>
+ </elementTypeConfigurations>
+</elementtypesconfigurations:ElementTypeSetConfiguration>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.gmfgen
index 67b9607f16c..d98b1c8ba18 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.gmfgen
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.gmfgen
@@ -1,3142 +1,3174 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xmi:XMI
- xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:gmfgen="http://www.eclipse.org/gmf/2009/GenModel"
- xmlns:papyrusgmfgenextension="http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension">
- <gmfgen:GenEditorGenerator
- packageNamePrefix="org.eclipse.papyrus.uml.diagram.deployment"
- modelID="PapyrusUMLDeploymentDiagram"
- diagramFileExtension="PapyrusUMLDeployment_diagram"
- domainFileExtension="umlDeployment"
- dynamicTemplates="true"
- templateDirectory="/org.eclipse.papyrus.def/xtend/"
- copyrightText="Copyright (c) 2014 CEA LIST.&#xD;&#xA;&#xD;&#xA;All rights reserved. This program and the accompanying materials&#xD;&#xA;are made available under the terms of the Eclipse Public License v1.0&#xD;&#xA;which accompanies this distribution, and is available at&#xD;&#xA;http://www.eclipse.org/legal/epl-v10.html&#xD;&#xA;&#xD;&#xA;Contributors:&#xD;&#xA; CEA LIST - Initial API and implementation"
- pluginDirectory="/org.eclipse.papyrus.uml.diagram.deployment/src">
- <diagram
- visualID="1000"
- editPartClassName="DeploymentDiagramEditPart"
- itemSemanticEditPolicyClassName="DeploymentDiagramItemSemanticEditPolicy"
- canonicalEditPolicyClassName="ModelCanonicalEditPolicy"
- iconProviderPriority="Low"
- creationWizardIconPath="icons/obj16/DeploymentDiagram.gif"
- validationProviderPriority="Low"
- 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.uml.diagram.deployment.Package_1000"
- displayName="DeploymentDiagram"
- editHelperClassName="ModelEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.draw2d.FreeformLayer"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;REMOVE_ORPHAN_VIEW&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <domainDiagramElement
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package"/>
- <childNodes
- visualID="49"
- editPartClassName="ModelEditPartCN"
- itemSemanticEditPolicyClassName="ModelItemSemanticEditPolicyCN"
- canonicalEditPolicyClassName="ModelCanonicalEditPolicyCN"
- compartments="/0/@diagram/@compartments.6"
- graphicalNodeEditPolicyClassName="ModelGraphicalNodeEditPolicyCN"
- createCommandClassName="ModelCreateCommandCN"
- containers="/0/@diagram/@compartments.0 /0/@diagram/@compartments.6 /0/@diagram/@compartments.1">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:SpecializationType"
- uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.Model_49"
- displayName="Model"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="150"
- height="150"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;RESIZE_BORDER_ITEMS&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Model"/>
- <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.1/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- visualID="50"
- editPartClassName="ModelNameEditPartCN"
- itemSemanticEditPolicyClassName="ModelNameItemSemanticEditPolicyCN"
- elementIcon="true">
- <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"/>
- <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="36"
- editPartClassName="PackageEditPartCN"
- itemSemanticEditPolicyClassName="PackageItemSemanticEditPolicyCN"
- canonicalEditPolicyClassName="PackageCanonicalEditPolicyCN"
- compartments="/0/@diagram/@compartments.7"
- graphicalNodeEditPolicyClassName="PackageGraphicalNodeEditPolicyCN"
- createCommandClassName="PackageCreateCommandCN"
- containers="/0/@diagram/@compartments.1 /0/@diagram/@compartments.7 /0/@diagram/@compartments.0 /0/@diagram/@compartments.6">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:SpecializationType"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="150"
- height="150"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;RESIZE_BORDER_ITEMS&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package"/>
- <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.1/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- visualID="37"
- editPartClassName="PackageNameEditPartCN"
- itemSemanticEditPolicyClassName="PackageNameItemSemanticEditPolicyCN"
- elementIcon="true">
- <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"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.0"
- editPattern="">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </childNodes>
- <childNodes
- visualID="16"
- editPartClassName="DeviceEditPartCN"
- itemSemanticEditPolicyClassName="DeviceItemSemanticEditPolicyCN"
- canonicalEditPolicyClassName="DeviceCanonicalEditPolicyCN"
- graphicalNodeEditPolicyClassName="DeviceGraphicalNodeEditPolicyCN"
- createCommandClassName="DeviceCreateCommandCN"
- containers="/0/@diagram/@compartments.4 /0/@diagram/@compartments.10 /0/@diagram/@compartments.2 /0/@diagram/@compartments.8">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:SpecializationType"
- uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.Device_16"
- displayName="Device"
- metamodelType="/0/@diagram/@topLevelNodes.6/@elementType"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeviceFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="150"
- height="100"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;REMOVE_ORPHAN_VIEW&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;RESIZE_BORDER_ITEMS&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Device"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Node/nestedNode"/>
- <childMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Node/nestedNode"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.1/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- visualID="20"
- editPartClassName="DeviceNameEditPartCN"
- itemSemanticEditPolicyClassName="DeviceNameItemSemanticEditPolicyCN">
- <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"/>
- <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="44"
- editPartClassName="NestedDeviceEditPartCN"
- itemSemanticEditPolicyClassName="NestedDeviceItemSemanticEditPolicyCN"
- canonicalEditPolicyClassName="NestedDeviceCanonicalEditPolicyCN"
- compartments="/0/@diagram/@compartments.8"
- graphicalNodeEditPolicyClassName="NestedDeviceGraphicalNodeEditPolicyCN"
- createCommandClassName="NestedDeviceCreateCommandCN"
- containers="/0/@diagram/@compartments.1 /0/@diagram/@compartments.7 /0/@diagram/@compartments.0 /0/@diagram/@compartments.6">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:SpecializationType"
- uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.Device_44"
- displayName="Device"
- metamodelType="/0/@diagram/@topLevelNodes.6/@elementType"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeviceFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="150"
- height="100"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;REMOVE_ORPHAN_VIEW&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;RESIZE_BORDER_ITEMS&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Device"/>
- <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.1/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- visualID="45"
- editPartClassName="NestedDeviceNameEditPartCN"
- itemSemanticEditPolicyClassName="NestedDeviceNameItemSemanticEditPolicyCN">
- <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"/>
- <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="21"
- editPartClassName="ExecutionEnvironmentEditPartCN"
- itemSemanticEditPolicyClassName="ExecutionEnvironmentItemSemanticEditPolicyCN"
- canonicalEditPolicyClassName="ExecutionEnvironmentCanonicalEditPolicyCN"
- graphicalNodeEditPolicyClassName="ExecutionEnvironmentGraphicalNodeEditPolicyCN"
- createCommandClassName="ExecutionEnvironmentCreateCommandCN"
- containers="/0/@diagram/@compartments.4 /0/@diagram/@compartments.2 /0/@diagram/@compartments.3 /0/@diagram/@compartments.8 /0/@diagram/@compartments.9 /0/@diagram/@compartments.10">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:SpecializationType"
- uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_21"
- displayName="ExecutionEnvironment"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ExecutionEnvironmentFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="150"
- height="100"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;REMOVE_ORPHAN_VIEW&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;RESIZE_BORDER_ITEMS&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ExecutionEnvironment"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Node/nestedNode"/>
- <childMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Node/nestedNode"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.1/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- visualID="22"
- editPartClassName="ExecutionEnvironmentNameEditPartCN"
- itemSemanticEditPolicyClassName="ExecutionEnvironmentNameItemSemanticEditPolicyCN">
- <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"/>
- <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="46"
- editPartClassName="NestedExecutionEnvironmentEditPartCN"
- itemSemanticEditPolicyClassName="NestedExecutionEnvironmentItemSemanticEditPolicyCN"
- canonicalEditPolicyClassName="NestedExecutionEnvironmentCanonicalEditPolicyCN"
- compartments="/0/@diagram/@compartments.9"
- graphicalNodeEditPolicyClassName="NestedExecutionEnvironmentGraphicalNodeEditPolicyCN"
- createCommandClassName="NestedExecutionEnvironmentCreateCommandCN"
- containers="/0/@diagram/@compartments.1 /0/@diagram/@compartments.7 /0/@diagram/@compartments.0 /0/@diagram/@compartments.6">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:SpecializationType"
- uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_46"
- displayName="ExecutionEnvironment"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ExecutionEnvironmentFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="150"
- height="100"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;REMOVE_ORPHAN_VIEW&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;RESIZE_BORDER_ITEMS&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ExecutionEnvironment"/>
- <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.1/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- visualID="47"
- editPartClassName="NestedExecutionEnvironmentNameEditPartCN"
- itemSemanticEditPolicyClassName="NestedExecutionEnvironmentNameItemSemanticEditPolicyCN">
- <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"/>
- <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="23"
- editPartClassName="NodeEditPartCN"
- itemSemanticEditPolicyClassName="NodeItemSemanticEditPolicyCN"
- canonicalEditPolicyClassName="NodeCanonicalEditPolicyCN"
- graphicalNodeEditPolicyClassName="NodeGraphicalNodeEditPolicyCN"
- createCommandClassName="NodeCreateCommandCN"
- containers="/0/@diagram/@compartments.4 /0/@diagram/@compartments.10 /0/@diagram/@compartments.2 /0/@diagram/@compartments.8">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:SpecializationType"
- displayName="Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.NodeFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="150"
- height="150"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;REMOVE_ORPHAN_VIEW&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;RESIZE_BORDER_ITEMS&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Node"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Node/nestedNode"/>
- <childMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Node/nestedNode"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.1/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- visualID="24"
- editPartClassName="NodeNameEditPartCN"
- itemSemanticEditPolicyClassName="NodeNameItemSemanticEditPolicyCN">
- <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"/>
- <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="42"
- editPartClassName="NestedNodeEditPartCN"
- itemSemanticEditPolicyClassName="NestedNodeItemSemanticEditPolicyCN"
- canonicalEditPolicyClassName="NestedNodeCanonicalEditPolicyCN"
- compartments="/0/@diagram/@compartments.10"
- graphicalNodeEditPolicyClassName="NestedNodeGraphicalNodeEditPolicyCN"
- createCommandClassName="NestedNodeCreateCommandCN"
- containers="/0/@diagram/@compartments.1 /0/@diagram/@compartments.7 /0/@diagram/@compartments.0 /0/@diagram/@compartments.6">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:SpecializationType"
- displayName="Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.NodeFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="150"
- height="150"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;REMOVE_ORPHAN_VIEW&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;RESIZE_BORDER_ITEMS&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Node"/>
- <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.1/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- visualID="43"
- editPartClassName="NestedNodeNameEditPart"
- itemSemanticEditPolicyClassName="NestedNodeNameItemSemanticEditPolicy">
- <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"/>
- <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="25"
- editPartClassName="ArtifactEditPartCN"
- itemSemanticEditPolicyClassName="ArtifactItemSemanticEditPolicyCN"
- canonicalEditPolicyClassName="ArtifactCanonicalEditPolicyCN"
- compartments="/0/@diagram/@compartments.11"
- graphicalNodeEditPolicyClassName="ArtifactGraphicalNodeEditPolicyCN"
- createCommandClassName="ArtifactCreateCommandCN"
- containers="/0/@diagram/@compartments.3 /0/@diagram/@compartments.4 /0/@diagram/@compartments.9 /0/@diagram/@compartments.10">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:SpecializationType"
- uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.Artifact_25"
- displayName="Artifact"
- metamodelType="/0/@diagram/@topLevelNodes.7/@elementType"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ArtifactFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="150"
- height="70"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;REMOVE_ORPHAN_VIEW&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.GetChildLayoutEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Class/nestedClassifier"/>
- <childMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Class/nestedClassifier"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.1/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact/fileName"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- visualID="27"
- editPartClassName="ArtifactNameEditPartCN"
- itemSemanticEditPolicyClassName="ArtifactNameItemSemanticEditPolicyCN">
- <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"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.0">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="59"
- editPartClassName="ArtifactFloatingLabelEditPartCN"
- itemSemanticEditPolicyClassName="ArtifactFloatingLabelItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"/>
- </viewmap>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.0"
- viewPattern=""
- editorPattern=""
- editPattern="">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </childNodes>
- <childNodes
- visualID="28"
- editPartClassName="ArtifactEditPartACN"
- itemSemanticEditPolicyClassName="ArtifactItemSemanticEditPolicyACN"
- canonicalEditPolicyClassName="ArtifactCanonicalEditPolicyACN"
- compartments="/0/@diagram/@compartments.12"
- graphicalNodeEditPolicyClassName="ArtifactGraphicalNodeEditPolicyACN"
- createCommandClassName="ArtifactCreateCommandACN"
- containers="/0/@diagram/@compartments.5 /0/@diagram/@compartments.11 /0/@diagram/@compartments.12">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:SpecializationType"
- displayName="Artifact"
- metamodelType="/0/@diagram/@topLevelNodes.7/@elementType"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ArtifactFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="150"
- height="70"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;REMOVE_ORPHAN_VIEW&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.GetChildLayoutEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact/nestedArtifact"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.1/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact/fileName"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- visualID="29"
- editPartClassName="ArtifactNameEditPartACN"
- itemSemanticEditPolicyClassName="ArtifactNameItemSemanticEditPolicyACN">
- <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"/>
- <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="60"
- editPartClassName="ArtifactFloatingLabelEditPartACN"
- itemSemanticEditPolicyClassName="ArtifactFloatingLabelItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"/>
- </viewmap>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.0"
- viewPattern=""
- editorPattern=""
- editPattern="">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </childNodes>
- <childNodes
- visualID="40"
- editPartClassName="NestedArtifactNodeEditPartCN"
- itemSemanticEditPolicyClassName="NestedArtifactNodeItemSemanticEditPolicyCN"
- canonicalEditPolicyClassName="NestedArtifactCanonicalEditPolicyCN"
- graphicalNodeEditPolicyClassName="NestedArtifactNodeGraphicalNodeEditPolicyCN"
- createCommandClassName="NestedArtifactNodeCreateCommandCN"
- containers="/0/@diagram/@compartments.1 /0/@diagram/@compartments.7 /0/@diagram/@compartments.0 /0/@diagram/@compartments.6">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:SpecializationType"
- displayName="Artifact"
- metamodelType="/0/@diagram/@topLevelNodes.7/@elementType"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ArtifactFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="150"
- height="70"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;REMOVE_ORPHAN_VIEW&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact"/>
- <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.1/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact/fileName"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- visualID="41"
- editPartClassName="NestedArtifactNameEditPart"
- itemSemanticEditPolicyClassName="NestedArtifactNameItemSemanticEditPolicy">
- <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"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.0"
- editPattern="">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </childNodes>
- <childNodes
- visualID="54"
- editPartClassName="CommentEditPartCN"
- itemSemanticEditPolicyClassName="CommentItemSemanticEditPolicyCN"
- canonicalEditPolicyClassName="CommentCanonicalEditPolicyCN"
- graphicalNodeEditPolicyClassName="CommentGraphicalNodeEditPolicyCN"
- createCommandClassName="CommentCreateCommandCN"
- containers="/0/@diagram/@compartments.0 /0/@diagram/@compartments.1 /0/@diagram/@compartments.6 /0/@diagram/@compartments.7">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- editHelperClassName="CommentEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.HTMLCornerBentFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusReflowableShapeEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Comment"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Element/ownedComment"/>
- <childMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Element/ownedComment"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.1/@expressions.2">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Comment/body"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- visualID="55"
- editPartClassName="CommentBodyEditPartCN"
- itemSemanticEditPolicyClassName="CommentBodyEditPartCN">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getCornerBentFigure"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.HTMLCornerBentFigure"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.1">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Comment/body"/>
- </modelFacet>
- </labels>
- </childNodes>
- <childNodes
- visualID="56"
- editPartClassName="ConstraintEditPartCN"
- itemSemanticEditPolicyClassName="ConstraintItemSemanticEditPolicyCN"
- canonicalEditPolicyClassName="ConstraintCanonicalEditPolicyCN"
- graphicalNodeEditPolicyClassName="ConstraintGraphicalNodeEditPolicyCN"
- createCommandClassName="ConstraintCreateCommandCN"
- containers="/0/@diagram/@compartments.0 /0/@diagram/@compartments.1 /0/@diagram/@compartments.6 /0/@diagram/@compartments.7">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- editHelperClassName="ConstraintEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.ConstraintFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Constraint"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Namespace/ownedRule"/>
- <childMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Namespace/ownedRule"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.1/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.1/@expressions.1">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Constraint/specification"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- visualID="57"
- editPartClassName="ConstraintNameEditPartCN"
- itemSemanticEditPolicyClassName="ConstraintNameItemSemanticEditPolicyCN">
- <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"/>
- <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="58"
- editPartClassName="ConstraintSpecificationEditPartCN"
- itemSemanticEditPolicyClassName="ConstraintSpecificationItemSemanticEditPolicyCN">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getConstraintFigure"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.ConstraintFigure"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.3">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Constraint/specification"/>
- <editableMetaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Constraint/specification"/>
- </modelFacet>
- </labels>
- </childNodes>
- <topLevelNodes
- visualID="2011"
- editPartClassName="DependencyNodeEditPart"
- itemSemanticEditPolicyClassName="DependencyNodeItemSemanticEditPolicy"
- canonicalEditPolicyClassName="DependencyNodeCanonicalEditPolicy"
- graphicalNodeEditPolicyClassName="DependencyNodeGraphicalNodeEditPolicy"
- createCommandClassName="DependencyNodeCreateCommand">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.Dependency_2011"
- displayName="DependencyNode"
- editHelperClassName="DependencyEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.DependencyNodeFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="10"
- height="10"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Dependency"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/>
- <childMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/>
- </modelFacet>
- <labels
- xsi:type="gmfgen:GenExternalNodeLabel"
- visualID="7"
- editPartClassName="MultiDependencyLabelEditPart"
- itemSemanticEditPolicyClassName="MultiDependencyLabelItemSemanticEditPolicy">
- <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>
- </topLevelNodes>
- <topLevelNodes
- visualID="2010"
- compartments="/0/@diagram/@compartments.0">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:SpecializationType"
- uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.Model_2010"
- displayName="Model"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="150"
- height="150"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;RESIZE_BORDER_ITEMS&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Model"/>
- <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.1/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- visualID="48"
- editPartClassName="ModelNameEditPart"
- itemSemanticEditPolicyClassName="ModelNameItemSemanticEditPolicy"
- elementIcon="true">
- <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"/>
- <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>
- <topLevelNodes
- visualID="2009"
- editPartClassName="PackageEditPart"
- itemSemanticEditPolicyClassName="PackageItemSemanticEditPolicy"
- canonicalEditPolicyClassName="PackageCanonicalEditPolicy"
- compartments="/0/@diagram/@compartments.1"
- graphicalNodeEditPolicyClassName="PackageGraphicalNodeEditPolicy"
- createCommandClassName="PackageCreateCommand">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:SpecializationType"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="150"
- height="150"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;RESIZE_BORDER_ITEMS&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package"/>
- <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.1/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- visualID="35"
- editPartClassName="PackageNameEditPart"
- itemSemanticEditPolicyClassName="PackageNameItemSemanticEditPolicy"
- elementIcon="true">
- <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"/>
- <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>
- <topLevelNodes
- visualID="2005"
- editPartClassName="ConstraintEditPart"
- itemSemanticEditPolicyClassName="ConstraintItemSemanticEditPolicy"
- canonicalEditPolicyClassName="ConstraintCanonicalEditPolicy"
- graphicalNodeEditPolicyClassName="ConstraintGraphicalNodeEditPolicy"
- createCommandClassName="ConstraintCreateCommand">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- editHelperClassName="ConstraintEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.ConstraintFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Constraint"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/>
- <childMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Namespace/ownedRule"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.1/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.1/@expressions.1">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Constraint/specification"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- visualID="2"
- editPartClassName="ConstraintNameEditPart"
- itemSemanticEditPolicyClassName="ConstraintNameItemSemanticEditPolicy">
- <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"/>
- <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="3"
- editPartClassName="ConstraintSpecificationEditPart"
- itemSemanticEditPolicyClassName="ConstraintSpecificationItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getConstraintFigure"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.ConstraintFigure"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.3">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Constraint/specification"/>
- <editableMetaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Constraint/specification"/>
- </modelFacet>
- </labels>
- </topLevelNodes>
- <topLevelNodes
- visualID="2001"
- editPartClassName="CommentEditPart"
- itemSemanticEditPolicyClassName="CommentItemSemanticEditPolicy"
- canonicalEditPolicyClassName="CommentCanonicalEditPolicy"
- graphicalNodeEditPolicyClassName="CommentGraphicalNodeEditPolicy"
- createCommandClassName="CommentCreateCommand">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- editHelperClassName="CommentEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.HTMLCornerBentFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusReflowableShapeEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Comment"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Element/ownedComment"/>
- <childMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Element/ownedComment"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.1/@expressions.2">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Comment/body"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- visualID="1"
- editPartClassName="CommentBodyEditPart"
- itemSemanticEditPolicyClassName="CommentBodyEditPart">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getCornerBentFigure"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.HTMLCornerBentFigure"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.1">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Comment/body"/>
- </modelFacet>
- </labels>
- </topLevelNodes>
- <topLevelNodes
- visualID="2002"
- editPartClassName="ExecutionEnvironmentEditPart"
- itemSemanticEditPolicyClassName="ExecutionEnvironmentItemSemanticEditPolicy"
- canonicalEditPolicyClassName="ExecutionEnvironmentCanonicalEditPolicy"
- compartments="/0/@diagram/@compartments.3"
- graphicalNodeEditPolicyClassName="ExecutionEnvironmentGraphicalNodeEditPolicy"
- createCommandClassName="ExecutionEnvironmentCreateCommand">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- editHelperClassName="ExecutionEnvironmentEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ExecutionEnvironmentFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="150"
- height="100"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;REMOVE_ORPHAN_VIEW&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;RESIZE_BORDER_ITEMS&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ExecutionEnvironment"/>
- <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.1/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- visualID="5"
- editPartClassName="ExecutionEnvironmentNameEditPart"
- itemSemanticEditPolicyClassName="ExecutionEnvironmentNameItemSemanticEditPolicy">
- <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"/>
- <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>
- <topLevelNodes
- visualID="2003"
- editPartClassName="DeviceEditPart"
- itemSemanticEditPolicyClassName="DeviceItemSemanticEditPolicy"
- canonicalEditPolicyClassName="DeviceCanonicalEditPolicy"
- compartments="/0/@diagram/@compartments.2"
- graphicalNodeEditPolicyClassName="DeviceGraphicalNodeEditPolicy"
- createCommandClassName="DeviceCreateCommand">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- editHelperClassName="DeviceEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeviceFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="150"
- height="100"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;REMOVE_ORPHAN_VIEW&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;RESIZE_BORDER_ITEMS&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Device"/>
- <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.1/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- visualID="6"
- editPartClassName="DeviceNameEditPart"
- itemSemanticEditPolicyClassName="DeviceNameItemSemanticEditPolicy">
- <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"/>
- <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>
- <topLevelNodes
- visualID="2006"
- editPartClassName="ArtifactEditPart"
- itemSemanticEditPolicyClassName="ArtifactItemSemanticEditPolicy"
- canonicalEditPolicyClassName="ArtifactCanonicalEditPolicy"
- compartments="/0/@diagram/@compartments.5"
- graphicalNodeEditPolicyClassName="ArtifactGraphicalNodeEditPolicy"
- createCommandClassName="ArtifactCreateCommand">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- editHelperClassName="ArtifactEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ArtifactFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="150"
- height="70"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;REMOVE_ORPHAN_VIEW&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.GetChildLayoutEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact"/>
- <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.1/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.0/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact/fileName"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- visualID="8"
- editPartClassName="ArtifactNameEditPart"
- itemSemanticEditPolicyClassName="ArtifactNameItemSemanticEditPolicy">
- <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"/>
- <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="61"
- editPartClassName="ArtifactFloatingLabelEditPart"
- itemSemanticEditPolicyClassName="ArtifactFloatingLabelItemSemanticEditPolicy">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel">
- <attributes
- xsi:type="gmfgen:LabelOffsetAttributes"
- x="25"/>
- </viewmap>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.0"
- viewPattern=""
- editorPattern=""
- editPattern="">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </topLevelNodes>
- <topLevelNodes
- visualID="2008"
- compartments="/0/@diagram/@compartments.4">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- editHelperClassName="NodeEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.NodeFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="150"
- height="150"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;REMOVE_ORPHAN_VIEW&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="&quot;RESIZE_BORDER_ITEMS&quot;"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Node"/>
- <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.1/@expressions.0">
- <feature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </initializers>
- </modelElementInitializer>
- </modelFacet>
- <labels
- visualID="9"
- editPartClassName="NodeNameEditPart"
- itemSemanticEditPolicyClassName="NodeNameItemSemanticEditPolicy">
- <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"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.0"
- editPattern="">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </topLevelNodes>
- <topLevelNodes
- visualID="2012"
- editPartClassName="DefaultNamedElementEditPart"
- itemSemanticEditPolicyClassName="DefaultNamedElementItemSemanticEditPolicy"
- canonicalEditPolicyClassName="DefaultNamedElementCanonicalEditPolicy"
- graphicalNodeEditPolicyClassName="DefaultNamedElementGraphicalNodeEditPolicy"
- createCommandClassName="DefaultNamedElementCreateCommand">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.NamedElement_2012"
- displayName="DefaultNamedElement"
- editHelperClassName="DefaultNamedElementEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure">
- <attributes
- xsi:type="gmfgen:DefaultSizeAttributes"
- width="100"
- height="50"/>
- </viewmap>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ChangeStereotypedShapeEditPolicy.CHANGE_SHAPE_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.DeploymentDiagramChangeStereotypedShapeEditpolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.itemsemantic.CustomDefaultNamedElementItemSemanticEditPolicy"/>
- <modelFacet>
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/>
- <childMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/>
- </modelFacet>
- <labels
- visualID="53"
- editPartClassName="DefaultNamedElementNameEditPart"
- itemSemanticEditPolicyClassName="DefaultNamedElementNameItemSemanticEditPolicy"
- elementIcon="true">
- <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"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.0"
- editPattern="">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- </topLevelNodes>
- <links
- visualID="4005"
- editPartClassName="LinkDescriptorEditPart"
- itemSemanticEditPolicyClassName="LinkDescriptorItemSemanticEditPolicy"
- createCommandClassName="LinkDescriptorCreateCommand"
- reorientCommandClassName="LinkDescriptorReorientCommand">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
- <elementType
- xsi:type="gmfgen:NotationType"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.edge.SimpleDashedEdgeFigure"/>
- </links>
- <links
- visualID="4008"
- editPartClassName="CommentAnnotatedElementEditPart"
- itemSemanticEditPolicyClassName="CommentAnnotatedElementItemSemanticEditPolicy"
- createCommandClassName="CommentAnnotatedElementCreateCommand"
- reorientCommandClassName="CommentAnnotatedElementReorientCommand">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
- <elementType
- xsi:type="gmfgen:SpecializationType"
- uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.CommentAnnotatedElement_4006"
- displayName="CommentAnnotatedElement"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.edge.SimpleDashedEdgeFigure"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLinkModelFacet">
- <metaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Comment/annotatedElement"/>
- </modelFacet>
- </links>
- <links
- visualID="4009"
- editPartClassName="ConstraintConstrainedElementEditPart"
- itemSemanticEditPolicyClassName="ConstraintConstrainedElementItemSemanticEditPolicy"
- createCommandClassName="ConstraintConstrainedElementCreateCommand"
- reorientCommandClassName="ConstraintConstrainedElementReorientCommand">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
- <elementType
- xsi:type="gmfgen:SpecializationType"
- uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.ConstraintConstrainedElement_4007"
- displayName="ConstraintConstrainedElement"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.edge.SimpleDashedEdgeFigure"/>
- <modelFacet
- xsi:type="gmfgen:FeatureLinkModelFacet">
- <metaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Constraint/constrainedElement"/>
- </modelFacet>
- </links>
- <links
- visualID="4001"
- editPartClassName="DeploymentEditPart"
- itemSemanticEditPolicyClassName="DeploymentItemSemanticEditPolicy"
- createCommandClassName="DeploymentCreateCommand"
- reorientCommandClassName="DeploymentReorientCommand">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- editHelperClassName="DeploymentEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy"/>
- <modelFacet
- xsi:type="gmfgen:TypeLinkModelFacet">
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Deployment"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/DeploymentTarget/deployment"/>
- <childMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/DeploymentTarget/deployment"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.1/@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/Dependency/client"/>
- <targetMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Dependency/supplier"/>
- </modelFacet>
- <labels
- visualID="13"
- editPartClassName="DeploymentNameEditPart"
- itemSemanticEditPolicyClassName="DeploymentNameItemSemanticEditPolicy">
- <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:LabelOffsetAttributes"
- y="60"/>
- </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
- visualID="14"
- editPartClassName="DeploymentAppliedStereotypeEditPart"
- itemSemanticEditPolicyClassName="DeploymentAppliedStereotypeItemSemanticEditPolicy">
- <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.2"
- 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="4002"
- editPartClassName="ManifestationEditPart"
- itemSemanticEditPolicyClassName="ManifestationItemSemanticEditPolicy"
- createCommandClassName="ManifestationCreateCommand"
- reorientCommandClassName="ManifestationReorientCommand">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- editHelperClassName="ManifestationEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy"/>
- <modelFacet
- xsi:type="gmfgen:TypeLinkModelFacet">
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Manifestation"/>
- <containmentMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact/manifestation"/>
- <childMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact/manifestation"/>
- <modelElementInitializer
- xsi:type="gmfgen:GenFeatureSeqInitializer">
- <initializers
- xsi:type="gmfgen:GenFeatureValueSpec"
- value="/0/@expressionProviders/@providers.1/@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/Dependency/client"/>
- <targetMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Dependency/supplier"/>
- </modelFacet>
- <labels
- visualID="10"
- editPartClassName="ManifestationNameEditPart"
- itemSemanticEditPolicyClassName="ManifestationNameItemSemanticEditPolicy">
- <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:LabelOffsetAttributes"
- y="60"/>
- </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
- visualID="11"
- editPartClassName="ManifestationAppliedStereotypeEditPart"
- itemSemanticEditPolicyClassName="ManifestationAppliedStereotypeItemSemanticEditPolicy">
- <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="30"/>
- </viewmap>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.2"
- 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="4003"
- editPartClassName="GeneralizationEditPart"
- itemSemanticEditPolicyClassName="GeneralizationItemSemanticEditPolicy"
- createCommandClassName="GeneralizationCreateCommand"
- reorientCommandClassName="GeneralizationReorientCommand">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
- <elementType
- xsi:type="gmfgen:MetamodelType"
- editHelperClassName="GeneralizationEditHelper"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.edge.GeneralizationFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy"/>
- <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"/>
- <sourceMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Generalization/specific"/>
- <targetMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Generalization/general"/>
- </modelFacet>
- <labels
- visualID="4"
- editPartClassName="GeneralizationAppliedStereotypeEditPart"
- itemSemanticEditPolicyClassName="GeneralizationAppliedStereotypeItemSemanticEditPolicy"
- 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.2"
- 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>
- <links
- visualID="4004"
- editPartClassName="DependencyEditPart"
- itemSemanticEditPolicyClassName="DependencyItemSemanticEditPolicy"
- createCommandClassName="DependencyCreateCommand"
- reorientCommandClassName="DependencyReorientCommand">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
- <elementType
- xsi:type="gmfgen:SpecializationType"
- displayName="DependencyLink"
- metamodelType="/0/@diagram/@topLevelNodes.0/@elementType"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
- <modelFacet
- xsi:type="gmfgen:TypeLinkModelFacet">
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Dependency"/>
- <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.1/@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/Dependency/client"/>
- <targetMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Dependency/supplier"/>
- </modelFacet>
- <labels
- visualID="12"
- editPartClassName="DependencyNameEditPart"
- itemSemanticEditPolicyClassName="DependencyNameItemSemanticEditPolicy">
- <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:LabelOffsetAttributes"
- y="40"/>
- </viewmap>
- <modelFacet
- xsi:type="gmfgen:FeatureLabelModelFacet"
- parser="/0/@labelParsers/@implementations.0"
- editorPattern="">
- <metaFeatures
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
- </modelFacet>
- </labels>
- <labels
- visualID="15"
- editPartClassName="DependencyAppliedStereotypeEditPart"
- itemSemanticEditPolicyClassName="DependencyAppliedStereotypeItemSemanticEditPolicy">
- <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.2"
- 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="4010"
- editPartClassName="DependencyBranchEditPart"
- itemSemanticEditPolicyClassName="DependencyBranchItemSemanticEditPolicy"
- createCommandClassName="DependencyBranchCreateCommand"
- reorientCommandClassName="DependencyBranchReorientCommand">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
- <elementType
- xsi:type="gmfgen:SpecializationType"
- uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.Dependency_4010"
- displayName="DependencyBranchLink"
- metamodelType="/0/@diagram/@topLevelNodes.0/@elementType"/>
- <viewmap
- xsi:type="gmfgen:FigureViewmap"
- figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
- <modelFacet
- xsi:type="gmfgen:TypeLinkModelFacet">
- <metaClass
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Dependency"/>
- <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.1/@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/Dependency/client"/>
- <targetMetaFeature
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Dependency/supplier"/>
- </modelFacet>
- </links>
- <compartments
- visualID="51"
- editPartClassName="ModelPackageableElementCompartmentEditPart"
- itemSemanticEditPolicyClassName="ModelPackageableElementCompartmentItemSemanticEditPolicy"
- canonicalEditPolicyClassName="ModelPackageableElementCompartmentCanonicalEditPolicy"
- childNodes="/0/@diagram/@childNodes.0 /0/@diagram/@childNodes.1 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12"
- title="ModelCompartment"
- canCollapse="false"
- node="/0/@diagram/@topLevelNodes.1"
- listLayout="false">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getPackageableElementFigure"
- figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- </compartments>
- <compartments
- visualID="38"
- editPartClassName="PackagePackageableElementCompartmentEditPart"
- itemSemanticEditPolicyClassName="PackagePackageableElementCompartmentItemSemanticEditPolicy"
- canonicalEditPolicyClassName="PackagePackageableElementCompartmentCanonicalEditPolicy"
- childNodes="/0/@diagram/@childNodes.0 /0/@diagram/@childNodes.1 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12"
- title="PackageableElementCompartment"
- canCollapse="false"
- node="/0/@diagram/@topLevelNodes.2"
- listLayout="false">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getPackageableElementFigure"
- figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- </compartments>
- <compartments
- visualID="17"
- editPartClassName="DeviceCompositeCompartmentEditPart"
- itemSemanticEditPolicyClassName="DeviceCompositeCompartmentItemSemanticEditPolicy"
- canonicalEditPolicyClassName="DeviceCompositeCompartmentCanonicalEditPolicy"
- childNodes="/0/@diagram/@childNodes.4 /0/@diagram/@childNodes.2 /0/@diagram/@childNodes.6"
- title="DeviceCompositeCompartment"
- canCollapse="false"
- node="/0/@diagram/@topLevelNodes.6"
- listLayout="false">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getCompositeCompartmentFigure"
- figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- </compartments>
- <compartments
- visualID="18"
- editPartClassName="ExecutionEnvironmentCompositeCompartmentEditPart"
- itemSemanticEditPolicyClassName="ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicy"
- canonicalEditPolicyClassName="ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicy"
- childNodes="/0/@diagram/@childNodes.4 /0/@diagram/@childNodes.8"
- title="ExecutionEnvironmentCompositeCompartment"
- canCollapse="false"
- node="/0/@diagram/@topLevelNodes.5"
- listLayout="false">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getCompositeCompartmentFigure"
- figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- </compartments>
- <compartments
- visualID="19"
- editPartClassName="NodeCompositeCompartmentEditPart"
- itemSemanticEditPolicyClassName="NodeCompositeCompartmentItemSemanticEditPolicy"
- canonicalEditPolicyClassName="NodeCompositeCompartmentCanonicalEditPolicy"
- childNodes="/0/@diagram/@childNodes.2 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.6"
- title="CompositeCompartment"
- canCollapse="false"
- node="/0/@diagram/@topLevelNodes.8"
- listLayout="false">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getCompositeCompartmentFigure"
- figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- </compartments>
- <compartments
- visualID="26"
- editPartClassName="ArtifactCompositeCompartmentEditPart"
- itemSemanticEditPolicyClassName="ArtifactCompositeCompartmentItemSemanticEditPolicy"
- canonicalEditPolicyClassName="ArtifactCompositeCompartmentCanonicalEditPolicy"
- childNodes="/0/@diagram/@childNodes.9"
- title="ArtifactCompositeCompartment"
- node="/0/@diagram/@topLevelNodes.7"
- listLayout="false">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getCompositeCompartmentFigure"
- figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.BorderDisplayEditPolicy.BORDER_DISPLAY_EDITPOLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.BorderDisplayEditPolicy"/>
- </compartments>
- <compartments
- visualID="52"
- editPartClassName="ModelPackageableElementCompartmentEditPartCN"
- itemSemanticEditPolicyClassName="ModelPackageableElementCompartmentItemSemanticEditPolicyCN"
- canonicalEditPolicyClassName="ModelPackageableElementCompartmentCanonicalEditPolicyCN"
- childNodes="/0/@diagram/@childNodes.0 /0/@diagram/@childNodes.1 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12"
- title="ModelCompartment"
- canCollapse="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="getPackageableElementFigure"
- figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- </compartments>
- <compartments
- visualID="39"
- editPartClassName="PackagePackageableElementCompartmentEditPartCN"
- itemSemanticEditPolicyClassName="PackagePackageableElementCompartmentItemSemanticEditPolicyCN"
- canonicalEditPolicyClassName="PackagePackageableElementCompartmentCanonicalEditPolicyCN"
- childNodes="/0/@diagram/@childNodes.1 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12"
- title="PackageableElementCompartment"
- canCollapse="false"
- node="/0/@diagram/@childNodes.1"
- listLayout="false">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getPackageableElementFigure"
- figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- </compartments>
- <compartments
- visualID="30"
- editPartClassName="DeviceCompositeCompartmentEditPartCN"
- itemSemanticEditPolicyClassName="DeviceCompositeCompartmentItemSemanticEditPolicyCN"
- canonicalEditPolicyClassName="DeviceCompositeCompartmentCanonicalEditPolicyCN"
- childNodes="/0/@diagram/@childNodes.4 /0/@diagram/@childNodes.2 /0/@diagram/@childNodes.6"
- title="DeviceCompositeCompartment"
- node="/0/@diagram/@childNodes.3"
- listLayout="false">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getCompositeCompartmentFigure"
- figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- </compartments>
- <compartments
- visualID="31"
- editPartClassName="ExecutionEnvironmentCompositeCompartmentEditPartCN"
- itemSemanticEditPolicyClassName="ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicyCN"
- canonicalEditPolicyClassName="ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicyCN"
- childNodes="/0/@diagram/@childNodes.8 /0/@diagram/@childNodes.4"
- title="ExecutionEnvironmentCompositeCompartment"
- node="/0/@diagram/@childNodes.5"
- listLayout="false">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getCompositeCompartmentFigure"
- figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- </compartments>
- <compartments
- visualID="32"
- editPartClassName="NodeCompositeCompartmentEditPartCN"
- itemSemanticEditPolicyClassName="NodeCompositeCompartmentItemSemanticEditPolicyCN"
- canonicalEditPolicyClassName="NodeCompositeCompartmentCanonicalEditPolicyCN"
- childNodes="/0/@diagram/@childNodes.2 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.8"
- title="CompositeCompartment"
- node="/0/@diagram/@childNodes.7"
- listLayout="false">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getCompositeCompartmentFigure"
- figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- </compartments>
- <compartments
- visualID="33"
- editPartClassName="ArtifactCompositeCompartmentEditPartCN"
- itemSemanticEditPolicyClassName="ArtifactCompositeCompartmentItemSemanticEditPolicyCN"
- canonicalEditPolicyClassName="ArtifactCompositeCompartmentCanonicalEditPolicyCN"
- childNodes="/0/@diagram/@childNodes.9"
- title="ArtifactCompositeCompartment"
- node="/0/@diagram/@childNodes.8"
- listLayout="false">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getCompositeCompartmentFigure"
- figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.BorderDisplayEditPolicy.BORDER_DISPLAY_EDITPOLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.BorderDisplayEditPolicy"/>
- </compartments>
- <compartments
- visualID="34"
- editPartClassName="ArtifactCompositeCompartmentEditPartACN"
- itemSemanticEditPolicyClassName="ArtifactCompositeCompartmentItemSemanticEditPolicyACN"
- canonicalEditPolicyClassName="ArtifactCompositeCompartmentCanonicalEditPolicyACN"
- childNodes="/0/@diagram/@childNodes.9"
- title="ArtifactCompositeCompartment"
- node="/0/@diagram/@childNodes.9"
- listLayout="false">
- <diagramRunTimeClass
- href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
- <viewmap
- xsi:type="gmfgen:ParentAssignedViewmap"
- getterName="getCompositeCompartmentFigure"
- figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
- editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
- <behaviour
- xsi:type="gmfgen:CustomBehaviour"
- key="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.BorderDisplayEditPolicy.BORDER_DISPLAY_EDITPOLICY"
- editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.BorderDisplayEditPolicy"/>
- </compartments>
- <palette>
- <groups
- title="Nodes"
- description="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"
- id="&quot;deployment.group.nodes&quot;"
- collapse="true">
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="Artifact"
- description="Create new Artifact"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Artifact.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Artifact.gif"
- createMethodName="createArtifactCreationTool"
- id="&quot;deployment.tool.artifact&quot;"
- genNodes="/0/@diagram/@topLevelNodes.7 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.10"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="Comment"
- description="Create new Comment"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Comment.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Comment.gif"
- createMethodName="createCommentCreationTool"
- id="&quot;deployment.tool.comment&quot;"
- genNodes="/0/@diagram/@topLevelNodes.4 /0/@diagram/@childNodes.11"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="Constraint"
- description="Create new Constraint"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Constraint.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Constraint.gif"
- createMethodName="createConstraintCreationTool"
- id="&quot;deployment.tool.constraint&quot;"
- genNodes="/0/@diagram/@topLevelNodes.3 /0/@diagram/@childNodes.12"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="Device"
- description="Create new Device"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Device.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Device.gif"
- createMethodName="createDeviceCreationTool"
- id="&quot;deployment.tool.device&quot;"
- genNodes="/0/@diagram/@topLevelNodes.6 /0/@diagram/@childNodes.2 /0/@diagram/@childNodes.3"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="Execution Environment"
- description="Create new ExecutionEnvironment"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ExecutionEnvironment.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ExecutionEnvironment.gif"
- createMethodName="createExecutionEnvironmentCreationTool"
- id="&quot;deployment.tool.executionEnvironment&quot;"
- genNodes="/0/@diagram/@topLevelNodes.5 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="Model"
- description="Create a model"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Model.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Model.gif"
- createMethodName="createModelCreationTool"
- genNodes="/0/@diagram/@childNodes.0 /0/@diagram/@topLevelNodes.1"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="Node"
- description="Create new Node"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Node.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Node.gif"
- createMethodName="createNodeCreationTool"
- id="&quot;deployment.tool.node&quot;"
- genNodes="/0/@diagram/@topLevelNodes.8 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.7"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="Package"
- description="Create a Package"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Package.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Package.gif"
- createMethodName="createPackageCreationTool"
- id="&quot;deployment.tool.package&quot;"
- genNodes="/0/@diagram/@topLevelNodes.2 /0/@diagram/@childNodes.1"/>
- </groups>
- <groups
- title="Links"
- description="Links"
- 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="createLinksGroup"
- id="&quot;deployment.group.links&quot;"
- collapse="true">
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="Dependency"
- description="Create new Dependency"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Dependency.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Dependency.gif"
- createMethodName="createDependencyCreationTool"
- id="&quot;deployment.tool.dependency&quot;"
- genLinks="/0/@diagram/@links.6"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="DependencyBranch"
- description="Create a dependency branch"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Dependency.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Dependency.gif"
- createMethodName="createDependencyBranchCreationTool"
- id="&quot;deployment.tool.dependencybranch&quot;"
- genLinks="/0/@diagram/@links.7"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="Deployment"
- description="Create new Deployment"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Deployment.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Deployment.gif"
- createMethodName="createDeploymentCreationTool"
- id="&quot;deployment.tool.deployment&quot;"
- genLinks="/0/@diagram/@links.3"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="Generalization"
- description="Create new Generalization"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Generalization.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Generalization.gif"
- createMethodName="createGeneralizationCreationTool"
- id="&quot;deployment.tool.generalization&quot;"
- genLinks="/0/@diagram/@links.5"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="Link"
- description="Create new Link (Comment / Constraint)"
- largeIconPath="icons/obj16/Link.gif"
- smallIconPath="icons/obj16/Link.gif"
- createMethodName="createLinkCreationTool"
- id="&quot;deployment.tool.link&quot;"
- genLinks="/0/@diagram/@links.1 /0/@diagram/@links.2"/>
- <entries
- xsi:type="gmfgen:ToolEntry"
- title="Manifestation"
- description="Create new Manifestation"
- largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Manifestation.gif"
- smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Manifestation.gif"
- createMethodName="createManifestationCreationTool"
- id="&quot;deployment.tool.manifestation&quot;"
- genLinks="/0/@diagram/@links.4"/>
- </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"/>
- </preferencePages>
- </diagram>
- <plugin
- iD="org.eclipse.papyrus.uml.diagram.deployment"
- name="Papyrus Deployment Diagram "
- provider="Eclipse Modeling Project"
- version="1.1.0.qualifier">
- <requiredPlugins>org.eclipse.draw2d</requiredPlugins>
- <requiredPlugins>org.eclipse.gmf.runtime.draw2d.ui</requiredPlugins>
- </plugin>
- <editor
- iconPath="icons/obj16/DeploymentDiagram.gif"/>
- <diagramUpdater/>
- <propertySheet>
- <tabs
- xsi:type="gmfgen:GenStandardPropertyTab"
- iD="appearance"/>
- <tabs
- xsi:type="gmfgen:GenStandardPropertyTab"
- iD="diagram"/>
- <tabs
- xsi:type="gmfgen:GenCustomPropertyTab"
- iD="domain"
- label="Core">
- <filter
- xsi:type="gmfgen:TypeTabFilter">
- <types>org.eclipse.gmf.runtime.notation.View</types>
- <types>org.eclipse.gef.EditPart</types>
- <generatedTypes>abstractNavigatorItem</generatedTypes>
- </filter>
- </tabs>
- </propertySheet>
- <domainGenModel
- href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#/"/>
- <expressionProviders>
- <providers
- xsi:type="gmfgen:GenExpressionInterpreter">
- <expressions
- body="self.name.concat('.file') "/>
- </providers>
- <providers
- xsi:type="gmfgen:GenJavaExpressionProvider"
- injectExpressionBody="true">
- <expressions
- body="return org.eclipse.papyrus.uml.tools.utils.NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());"/>
- <expressions
- body="// Constraint specification init&#xD;&#xA;org.eclipse.uml2.uml.LiteralString value = org.eclipse.uml2.uml.UMLFactory.eINSTANCE.createLiteralString();&#xD;&#xA;value.setValue(&quot;&quot;);&#xD;&#xA;return value;"/>
- <expressions
- body="// Comment body init&#xD;&#xA;return &quot;&quot;;"/>
- <expressions
- xsi:type="gmfgen:GenConstraint"
- body="// Creation constraint for TopLevelNodes&#xD;&#xA;&#x9;if(! (getElementToEdit() instanceof org.eclipse.uml2.uml.Package)) {&#xD;&#xA;&#x9;&#x9;return false;&#xD;&#xA;&#x9;}&#xD;&#xA;&#xD;&#xA;&#x9;return true;"/>
- </providers>
- </expressionProviders>
- <labelParsers
- extensibleViaService="true">
- <implementations
- xsi:type="gmfgen:PredefinedParser"
- uses="/0/@diagram/@topLevelNodes.3/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.5/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.6/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.7/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.8/@labels.0/@modelFacet /0/@diagram/@links.4/@labels.0/@modelFacet /0/@diagram/@links.6/@labels.0/@modelFacet /0/@diagram/@links.3/@labels.0/@modelFacet /0/@diagram/@childNodes.2/@labels.0/@modelFacet /0/@diagram/@childNodes.4/@labels.0/@modelFacet /0/@diagram/@childNodes.6/@labels.0/@modelFacet /0/@diagram/@childNodes.8/@labels.0/@modelFacet /0/@diagram/@childNodes.9/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.2/@labels.0/@modelFacet /0/@diagram/@childNodes.1/@labels.0/@modelFacet /0/@diagram/@childNodes.10/@labels.0/@modelFacet /0/@diagram/@childNodes.7/@labels.0/@modelFacet /0/@diagram/@childNodes.3/@labels.0/@modelFacet /0/@diagram/@childNodes.5/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.1/@labels.0/@modelFacet /0/@diagram/@childNodes.0/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.0/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.9/@labels.0/@modelFacet /0/@diagram/@childNodes.12/@labels.0/@modelFacet /0/@diagram/@childNodes.8/@labels.1/@modelFacet /0/@diagram/@childNodes.9/@labels.1/@modelFacet /0/@diagram/@topLevelNodes.7/@labels.1/@modelFacet"/>
- <implementations
- xsi:type="gmfgen:CustomParser"
- uses="/0/@diagram/@topLevelNodes.4/@labels.0/@modelFacet /0/@diagram/@childNodes.11/@labels.0/@modelFacet"
- qualifiedName="org.eclipse.papyrus.uml.diagram.common.parser.CommentParser"/>
- <implementations
- xsi:type="gmfgen:CustomParser"
- uses="/0/@diagram/@links.5/@labels.0/@modelFacet /0/@diagram/@links.4/@labels.1/@modelFacet /0/@diagram/@links.6/@labels.1/@modelFacet /0/@diagram/@links.3/@labels.1/@modelFacet"
- qualifiedName="org.eclipse.papyrus.uml.diagram.common.parser.stereotype.AppliedStereotypeParser"/>
- <implementations
- xsi:type="gmfgen:CustomParser"
- uses="/0/@diagram/@topLevelNodes.3/@labels.1/@modelFacet /0/@diagram/@childNodes.12/@labels.1/@modelFacet"
- qualifiedName="org.eclipse.papyrus.uml.diagram.common.parser.ConstraintParser"/>
- </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="Manages stereotype shown with External Label"
- genView="/0/@diagram/@links.5/@labels.0 /0/@diagram/@links.3/@labels.1 /0/@diagram/@links.4/@labels.1 /0/@diagram/@links.6/@labels.1"
- name="EP_Stereotypes_EXT_NODE"
- superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:ExtendedGenView"
- comment="Add super class to a Comment edit parts"
- genView="/0/@diagram/@childNodes.11 /0/@diagram/@topLevelNodes.4"
- name="EP_Comment_NODE"
- superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractCommentEditPart"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:ExtendedGenView"
- comment="Add super class to a Constraint edit parts"
- genView="/0/@diagram/@childNodes.12 /0/@diagram/@topLevelNodes.3"
- name="EP_Constraint_NODE"
- superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractConstraintEditPart"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:ExtendedGenView"
- comment="Label in charge to display applied stereotypes on links"
- genView="/0/@diagram/@links.3 /0/@diagram/@links.4 /0/@diagram/@links.6 /0/@diagram/@links.5 /0/@diagram/@links.7 /0/@diagram/@links.2"
- name="ExtendedUMLLinks"
- superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.UMLConnectionNodeEditPart"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:ExtendedGenView"
- comment="adding to manange NamedElement"
- genView="/0/@diagram /0/@diagram/@topLevelNodes.9 /0/@diagram/@topLevelNodes.8 /0/@diagram/@childNodes.6 /0/@diagram/@topLevelNodes.6 /0/@diagram/@childNodes.2 /0/@diagram/@topLevelNodes.5 /0/@diagram/@childNodes.4"
- name="NamedElementEditPart"
- superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:GenNodeConstraint"
- comment="Creation constraint for TopLevelNode in virtual canvas"
- genNode="/0/@diagram/@topLevelNodes.2 /0/@diagram/@topLevelNodes.4 /0/@diagram/@topLevelNodes.3 /0/@diagram/@topLevelNodes.5 /0/@diagram/@topLevelNodes.6 /0/@diagram/@topLevelNodes.7 /0/@diagram/@topLevelNodes.8"
- genConstraint="/0/@expressionProviders/@providers.1/@expressions.3"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:AdditionalEditPartCandies"
- comment="Indicate specific BaseEditHelper in place of generated EditHelper"
- baseEditHelperPackage="org.eclipse.papyrus.uml.diagram.common.helper"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:EditPartUsingDeleteService"
- comment="The delete service is used on every TopNode Childnode and Link"
- name="Every TopNode ChildNode Link"
- genView="/0/@diagram/@topLevelNodes.0 /0/@diagram/@topLevelNodes.2 /0/@diagram/@topLevelNodes.4 /0/@diagram/@topLevelNodes.3 /0/@diagram/@topLevelNodes.5 /0/@diagram/@topLevelNodes.6 /0/@diagram/@topLevelNodes.7 /0/@diagram/@topLevelNodes.8 /0/@diagram/@childNodes.1 /0/@diagram/@links.3 /0/@diagram/@links.4 /0/@diagram/@links.5 /0/@diagram/@links.6 /0/@diagram/@links.7 /0/@diagram/@links.1 /0/@diagram/@links.2"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:EditPartUsingReorientService"
- comment="Use the edit service for reorient command (All DirectedRelationship)"
- name="DirectedRelationship"
- genView="/0/@diagram/@links.3 /0/@diagram/@links.4 /0/@diagram/@links.5 /0/@diagram/@links.6 /0/@diagram/@links.7"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:LabelVisibilityPreference"
- comment="Name"
- role="Name"
- linkLabels="/0/@diagram/@links.3/@labels.0 /0/@diagram/@links.4/@labels.0 /0/@diagram/@links.6/@labels.0"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:LabelVisibilityPreference"
- comment="Stereotype"
- role="Stereotype"
- linkLabels="/0/@diagram/@links.5/@labels.0 /0/@diagram/@links.3/@labels.1 /0/@diagram/@links.4/@labels.1 /0/@diagram/@links.6/@labels.1"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:CompartmentTitleVisibilityPreference"
- comment="Hidden Compartments Titles"
- visibleByDefault="false"
- compartments="/0/@diagram/@compartments.2 /0/@diagram/@compartments.3 /0/@diagram/@compartments.4 /0/@diagram/@compartments.5 /0/@diagram/@compartments.8 /0/@diagram/@compartments.9 /0/@diagram/@compartments.10 /0/@diagram/@compartments.11 /0/@diagram/@compartments.12 /0/@diagram/@compartments.1 /0/@diagram/@compartments.7 /0/@diagram/@compartments.0 /0/@diagram/@compartments.6"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:CompartmentVisibilityPreference"
- comment="Hidden Compartments"
- visibleByDefault="false"
- compartments="/0/@diagram/@compartments.5 /0/@diagram/@compartments.11 /0/@diagram/@compartments.12"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:ExtendedGenView"
- comment="add superclass for floating Label"
- genView="/0/@diagram/@childNodes.9/@labels.1 /0/@diagram/@topLevelNodes.7/@labels.1 /0/@diagram/@childNodes.8/@labels.1"
- name="FloatingLabelEditPart"
- superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:ExtendedGenView"
- comment=""
- genView="/0/@diagram/@topLevelNodes.7 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.8"
- name="RoundedCompartmentEditPart"
- superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:SpecificLocatorExternalLabel"
- comment="Locator for external Floating label of RoundedCompartment EP"
- classpath="org.eclipse.papyrus.uml.diagram.common.locator.RoundedRectangleLabelPositionLocator"
- genExternalNodeLabel="/0/@diagram/@topLevelNodes.7/@labels.1 /0/@diagram/@childNodes.9/@labels.1 /0/@diagram/@childNodes.8/@labels.1"/>
- <extensionNodes
- xsi:type="papyrusgmfgenextension:ExtendedGenView"
- genView="/0/@diagram/@childNodes.1 /0/@diagram/@topLevelNodes.2 /0/@diagram/@childNodes.0 /0/@diagram/@topLevelNodes.1"
- name="PackageEditPart"
- superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.PackageEditPart"/>
- </papyrusgmfgenextension:PapyrusExtensionRootNode>
-</xmi:XMI>
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:gmfgen="http://www.eclipse.org/gmf/2009/GenModel"
+ xmlns:papyrusgmfgenextension="http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension">
+ <gmfgen:GenEditorGenerator
+ packageNamePrefix="org.eclipse.papyrus.uml.diagram.deployment"
+ modelID="PapyrusUMLDeploymentDiagram"
+ diagramFileExtension="PapyrusUMLDeployment_diagram"
+ domainFileExtension="umlDeployment"
+ dynamicTemplates="true"
+ templateDirectory="/org.eclipse.papyrus.def/xtend/"
+ copyrightText="Copyright (c) 2014 CEA LIST.&#xD;&#xA;&#xD;&#xA;All rights reserved. This program and the accompanying materials&#xD;&#xA;are made available under the terms of the Eclipse Public License v1.0&#xD;&#xA;which accompanies this distribution, and is available at&#xD;&#xA;http://www.eclipse.org/legal/epl-v10.html&#xD;&#xA;&#xD;&#xA;Contributors:&#xD;&#xA; CEA LIST - Initial API and implementation"
+ pluginDirectory="/org.eclipse.papyrus.uml.diagram.deployment/src">
+ <diagram
+ visualID="1000"
+ editPartClassName="DeploymentDiagramEditPart"
+ itemSemanticEditPolicyClassName="DeploymentDiagramItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="ModelCanonicalEditPolicy"
+ iconProviderPriority="Low"
+ creationWizardIconPath="icons/obj16/DeploymentDiagram.gif"
+ validationProviderPriority="Low"
+ 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.uml.diagram.deployment.Package_1000"
+ displayName="DeploymentDiagram"
+ definedExternally="true"
+ editHelperClassName="ModelEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.draw2d.FreeformLayer"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;REMOVE_ORPHAN_VIEW&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <domainDiagramElement
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package"/>
+ <childNodes
+ visualID="49"
+ editPartClassName="ModelEditPartCN"
+ itemSemanticEditPolicyClassName="ModelItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="ModelCanonicalEditPolicyCN"
+ compartments="/0/@diagram/@compartments.6"
+ graphicalNodeEditPolicyClassName="ModelGraphicalNodeEditPolicyCN"
+ createCommandClassName="ModelCreateCommandCN"
+ containers="/0/@diagram/@compartments.0 /0/@diagram/@compartments.6 /0/@diagram/@compartments.1">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.Model_49"
+ displayName="Model"
+ definedExternally="true"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure">
+ <attributes
+ xsi:type="gmfgen:DefaultSizeAttributes"
+ width="150"
+ height="150"/>
+ </viewmap>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;RESIZE_BORDER_ITEMS&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Model"/>
+ <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.1/@expressions.0">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </initializers>
+ </modelElementInitializer>
+ </modelFacet>
+ <labels
+ visualID="50"
+ editPartClassName="ModelNameEditPartCN"
+ itemSemanticEditPolicyClassName="ModelNameItemSemanticEditPolicyCN"
+ elementIcon="true">
+ <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"/>
+ <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="36"
+ editPartClassName="PackageEditPartCN"
+ itemSemanticEditPolicyClassName="PackageItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="PackageCanonicalEditPolicyCN"
+ compartments="/0/@diagram/@compartments.7"
+ graphicalNodeEditPolicyClassName="PackageGraphicalNodeEditPolicyCN"
+ createCommandClassName="PackageCreateCommandCN"
+ containers="/0/@diagram/@compartments.1 /0/@diagram/@compartments.7 /0/@diagram/@compartments.0 /0/@diagram/@compartments.6">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ definedExternally="true"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure">
+ <attributes
+ xsi:type="gmfgen:DefaultSizeAttributes"
+ width="150"
+ height="150"/>
+ </viewmap>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;RESIZE_BORDER_ITEMS&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package"/>
+ <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.1/@expressions.0">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </initializers>
+ </modelElementInitializer>
+ </modelFacet>
+ <labels
+ visualID="37"
+ editPartClassName="PackageNameEditPartCN"
+ itemSemanticEditPolicyClassName="PackageNameItemSemanticEditPolicyCN"
+ elementIcon="true">
+ <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"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0"
+ editPattern="">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </childNodes>
+ <childNodes
+ visualID="16"
+ editPartClassName="DeviceEditPartCN"
+ itemSemanticEditPolicyClassName="DeviceItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="DeviceCanonicalEditPolicyCN"
+ graphicalNodeEditPolicyClassName="DeviceGraphicalNodeEditPolicyCN"
+ createCommandClassName="DeviceCreateCommandCN"
+ containers="/0/@diagram/@compartments.4 /0/@diagram/@compartments.10 /0/@diagram/@compartments.2 /0/@diagram/@compartments.8">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.Device_16"
+ displayName="Device"
+ definedExternally="true"
+ metamodelType="/0/@diagram/@topLevelNodes.6/@elementType"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeviceFigure">
+ <attributes
+ xsi:type="gmfgen:DefaultSizeAttributes"
+ width="150"
+ height="100"/>
+ </viewmap>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;REMOVE_ORPHAN_VIEW&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;RESIZE_BORDER_ITEMS&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Device"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Node/nestedNode"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Node/nestedNode"/>
+ <modelElementInitializer
+ xsi:type="gmfgen:GenFeatureSeqInitializer">
+ <initializers
+ xsi:type="gmfgen:GenFeatureValueSpec"
+ value="/0/@expressionProviders/@providers.1/@expressions.0">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </initializers>
+ </modelElementInitializer>
+ </modelFacet>
+ <labels
+ visualID="20"
+ editPartClassName="DeviceNameEditPartCN"
+ itemSemanticEditPolicyClassName="DeviceNameItemSemanticEditPolicyCN">
+ <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"/>
+ <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="44"
+ editPartClassName="NestedDeviceEditPartCN"
+ itemSemanticEditPolicyClassName="NestedDeviceItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="NestedDeviceCanonicalEditPolicyCN"
+ compartments="/0/@diagram/@compartments.8"
+ graphicalNodeEditPolicyClassName="NestedDeviceGraphicalNodeEditPolicyCN"
+ createCommandClassName="NestedDeviceCreateCommandCN"
+ containers="/0/@diagram/@compartments.1 /0/@diagram/@compartments.7 /0/@diagram/@compartments.0 /0/@diagram/@compartments.6">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.Device_44"
+ displayName="Device"
+ definedExternally="true"
+ metamodelType="/0/@diagram/@topLevelNodes.6/@elementType"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeviceFigure">
+ <attributes
+ xsi:type="gmfgen:DefaultSizeAttributes"
+ width="150"
+ height="100"/>
+ </viewmap>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;REMOVE_ORPHAN_VIEW&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;RESIZE_BORDER_ITEMS&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Device"/>
+ <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.1/@expressions.0">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </initializers>
+ </modelElementInitializer>
+ </modelFacet>
+ <labels
+ visualID="45"
+ editPartClassName="NestedDeviceNameEditPartCN"
+ itemSemanticEditPolicyClassName="NestedDeviceNameItemSemanticEditPolicyCN">
+ <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"/>
+ <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="21"
+ editPartClassName="ExecutionEnvironmentEditPartCN"
+ itemSemanticEditPolicyClassName="ExecutionEnvironmentItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="ExecutionEnvironmentCanonicalEditPolicyCN"
+ graphicalNodeEditPolicyClassName="ExecutionEnvironmentGraphicalNodeEditPolicyCN"
+ createCommandClassName="ExecutionEnvironmentCreateCommandCN"
+ containers="/0/@diagram/@compartments.4 /0/@diagram/@compartments.2 /0/@diagram/@compartments.3 /0/@diagram/@compartments.8 /0/@diagram/@compartments.9 /0/@diagram/@compartments.10">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_21"
+ displayName="ExecutionEnvironment"
+ definedExternally="true"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ExecutionEnvironmentFigure">
+ <attributes
+ xsi:type="gmfgen:DefaultSizeAttributes"
+ width="150"
+ height="100"/>
+ </viewmap>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;REMOVE_ORPHAN_VIEW&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;RESIZE_BORDER_ITEMS&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ExecutionEnvironment"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Node/nestedNode"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Node/nestedNode"/>
+ <modelElementInitializer
+ xsi:type="gmfgen:GenFeatureSeqInitializer">
+ <initializers
+ xsi:type="gmfgen:GenFeatureValueSpec"
+ value="/0/@expressionProviders/@providers.1/@expressions.0">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </initializers>
+ </modelElementInitializer>
+ </modelFacet>
+ <labels
+ visualID="22"
+ editPartClassName="ExecutionEnvironmentNameEditPartCN"
+ itemSemanticEditPolicyClassName="ExecutionEnvironmentNameItemSemanticEditPolicyCN">
+ <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"/>
+ <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="46"
+ editPartClassName="NestedExecutionEnvironmentEditPartCN"
+ itemSemanticEditPolicyClassName="NestedExecutionEnvironmentItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="NestedExecutionEnvironmentCanonicalEditPolicyCN"
+ compartments="/0/@diagram/@compartments.9"
+ graphicalNodeEditPolicyClassName="NestedExecutionEnvironmentGraphicalNodeEditPolicyCN"
+ createCommandClassName="NestedExecutionEnvironmentCreateCommandCN"
+ containers="/0/@diagram/@compartments.1 /0/@diagram/@compartments.7 /0/@diagram/@compartments.0 /0/@diagram/@compartments.6">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_46"
+ displayName="ExecutionEnvironment"
+ definedExternally="true"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ExecutionEnvironmentFigure">
+ <attributes
+ xsi:type="gmfgen:DefaultSizeAttributes"
+ width="150"
+ height="100"/>
+ </viewmap>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;REMOVE_ORPHAN_VIEW&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;RESIZE_BORDER_ITEMS&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ExecutionEnvironment"/>
+ <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.1/@expressions.0">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </initializers>
+ </modelElementInitializer>
+ </modelFacet>
+ <labels
+ visualID="47"
+ editPartClassName="NestedExecutionEnvironmentNameEditPartCN"
+ itemSemanticEditPolicyClassName="NestedExecutionEnvironmentNameItemSemanticEditPolicyCN">
+ <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"/>
+ <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="23"
+ editPartClassName="NodeEditPartCN"
+ itemSemanticEditPolicyClassName="NodeItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="NodeCanonicalEditPolicyCN"
+ graphicalNodeEditPolicyClassName="NodeGraphicalNodeEditPolicyCN"
+ createCommandClassName="NodeCreateCommandCN"
+ containers="/0/@diagram/@compartments.4 /0/@diagram/@compartments.10 /0/@diagram/@compartments.2 /0/@diagram/@compartments.8">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ displayName="Node"
+ definedExternally="true"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.NodeFigure">
+ <attributes
+ xsi:type="gmfgen:DefaultSizeAttributes"
+ width="150"
+ height="150"/>
+ </viewmap>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;REMOVE_ORPHAN_VIEW&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;RESIZE_BORDER_ITEMS&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Node"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Node/nestedNode"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Node/nestedNode"/>
+ <modelElementInitializer
+ xsi:type="gmfgen:GenFeatureSeqInitializer">
+ <initializers
+ xsi:type="gmfgen:GenFeatureValueSpec"
+ value="/0/@expressionProviders/@providers.1/@expressions.0">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </initializers>
+ </modelElementInitializer>
+ </modelFacet>
+ <labels
+ visualID="24"
+ editPartClassName="NodeNameEditPartCN"
+ itemSemanticEditPolicyClassName="NodeNameItemSemanticEditPolicyCN">
+ <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"/>
+ <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="42"
+ editPartClassName="NestedNodeEditPartCN"
+ itemSemanticEditPolicyClassName="NestedNodeItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="NestedNodeCanonicalEditPolicyCN"
+ compartments="/0/@diagram/@compartments.10"
+ graphicalNodeEditPolicyClassName="NestedNodeGraphicalNodeEditPolicyCN"
+ createCommandClassName="NestedNodeCreateCommandCN"
+ containers="/0/@diagram/@compartments.1 /0/@diagram/@compartments.7 /0/@diagram/@compartments.0 /0/@diagram/@compartments.6">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ displayName="Node"
+ definedExternally="true"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.NodeFigure">
+ <attributes
+ xsi:type="gmfgen:DefaultSizeAttributes"
+ width="150"
+ height="150"/>
+ </viewmap>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;REMOVE_ORPHAN_VIEW&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;RESIZE_BORDER_ITEMS&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Node"/>
+ <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.1/@expressions.0">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </initializers>
+ </modelElementInitializer>
+ </modelFacet>
+ <labels
+ visualID="43"
+ editPartClassName="NestedNodeNameEditPart"
+ itemSemanticEditPolicyClassName="NestedNodeNameItemSemanticEditPolicy">
+ <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"/>
+ <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="25"
+ editPartClassName="ArtifactEditPartCN"
+ itemSemanticEditPolicyClassName="ArtifactItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="ArtifactCanonicalEditPolicyCN"
+ compartments="/0/@diagram/@compartments.11"
+ graphicalNodeEditPolicyClassName="ArtifactGraphicalNodeEditPolicyCN"
+ createCommandClassName="ArtifactCreateCommandCN"
+ containers="/0/@diagram/@compartments.3 /0/@diagram/@compartments.4 /0/@diagram/@compartments.9 /0/@diagram/@compartments.10">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.Artifact_25"
+ displayName="Artifact"
+ definedExternally="true"
+ metamodelType="/0/@diagram/@topLevelNodes.7/@elementType"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ArtifactFigure">
+ <attributes
+ xsi:type="gmfgen:DefaultSizeAttributes"
+ width="150"
+ height="70"/>
+ </viewmap>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;REMOVE_ORPHAN_VIEW&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.GetChildLayoutEditPolicy"/>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Class/nestedClassifier"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Class/nestedClassifier"/>
+ <modelElementInitializer
+ xsi:type="gmfgen:GenFeatureSeqInitializer">
+ <initializers
+ xsi:type="gmfgen:GenFeatureValueSpec"
+ value="/0/@expressionProviders/@providers.1/@expressions.0">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </initializers>
+ <initializers
+ xsi:type="gmfgen:GenFeatureValueSpec"
+ value="/0/@expressionProviders/@providers.0/@expressions.0">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact/fileName"/>
+ </initializers>
+ </modelElementInitializer>
+ </modelFacet>
+ <labels
+ visualID="27"
+ editPartClassName="ArtifactNameEditPartCN"
+ itemSemanticEditPolicyClassName="ArtifactNameItemSemanticEditPolicyCN">
+ <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"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ <labels
+ xsi:type="gmfgen:GenExternalNodeLabel"
+ visualID="59"
+ editPartClassName="ArtifactFloatingLabelEditPartCN"
+ itemSemanticEditPolicyClassName="ArtifactFloatingLabelItemSemanticEditPolicy">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel">
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ x="25"/>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0"
+ viewPattern=""
+ editorPattern=""
+ editPattern="">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </childNodes>
+ <childNodes
+ visualID="28"
+ editPartClassName="ArtifactEditPartACN"
+ itemSemanticEditPolicyClassName="ArtifactItemSemanticEditPolicyACN"
+ canonicalEditPolicyClassName="ArtifactCanonicalEditPolicyACN"
+ compartments="/0/@diagram/@compartments.12"
+ graphicalNodeEditPolicyClassName="ArtifactGraphicalNodeEditPolicyACN"
+ createCommandClassName="ArtifactCreateCommandACN"
+ containers="/0/@diagram/@compartments.5 /0/@diagram/@compartments.11 /0/@diagram/@compartments.12">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ displayName="Artifact"
+ definedExternally="true"
+ metamodelType="/0/@diagram/@topLevelNodes.7/@elementType"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ArtifactFigure">
+ <attributes
+ xsi:type="gmfgen:DefaultSizeAttributes"
+ width="150"
+ height="70"/>
+ </viewmap>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;REMOVE_ORPHAN_VIEW&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.GetChildLayoutEditPolicy"/>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact/nestedArtifact"/>
+ <modelElementInitializer
+ xsi:type="gmfgen:GenFeatureSeqInitializer">
+ <initializers
+ xsi:type="gmfgen:GenFeatureValueSpec"
+ value="/0/@expressionProviders/@providers.1/@expressions.0">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </initializers>
+ <initializers
+ xsi:type="gmfgen:GenFeatureValueSpec"
+ value="/0/@expressionProviders/@providers.0/@expressions.0">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact/fileName"/>
+ </initializers>
+ </modelElementInitializer>
+ </modelFacet>
+ <labels
+ visualID="29"
+ editPartClassName="ArtifactNameEditPartACN"
+ itemSemanticEditPolicyClassName="ArtifactNameItemSemanticEditPolicyACN">
+ <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"/>
+ <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="60"
+ editPartClassName="ArtifactFloatingLabelEditPartACN"
+ itemSemanticEditPolicyClassName="ArtifactFloatingLabelItemSemanticEditPolicy">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel">
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ x="25"/>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0"
+ viewPattern=""
+ editorPattern=""
+ editPattern="">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </childNodes>
+ <childNodes
+ visualID="40"
+ editPartClassName="NestedArtifactNodeEditPartCN"
+ itemSemanticEditPolicyClassName="NestedArtifactNodeItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="NestedArtifactCanonicalEditPolicyCN"
+ graphicalNodeEditPolicyClassName="NestedArtifactNodeGraphicalNodeEditPolicyCN"
+ createCommandClassName="NestedArtifactNodeCreateCommandCN"
+ containers="/0/@diagram/@compartments.1 /0/@diagram/@compartments.7 /0/@diagram/@compartments.0 /0/@diagram/@compartments.6">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ displayName="Artifact"
+ definedExternally="true"
+ metamodelType="/0/@diagram/@topLevelNodes.7/@elementType"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ArtifactFigure">
+ <attributes
+ xsi:type="gmfgen:DefaultSizeAttributes"
+ width="150"
+ height="70"/>
+ </viewmap>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;REMOVE_ORPHAN_VIEW&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact"/>
+ <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.1/@expressions.0">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </initializers>
+ <initializers
+ xsi:type="gmfgen:GenFeatureValueSpec"
+ value="/0/@expressionProviders/@providers.0/@expressions.0">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact/fileName"/>
+ </initializers>
+ </modelElementInitializer>
+ </modelFacet>
+ <labels
+ visualID="41"
+ editPartClassName="NestedArtifactNameEditPart"
+ itemSemanticEditPolicyClassName="NestedArtifactNameItemSemanticEditPolicy">
+ <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"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0"
+ editPattern="">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </childNodes>
+ <childNodes
+ visualID="54"
+ editPartClassName="CommentEditPartCN"
+ itemSemanticEditPolicyClassName="CommentItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="CommentCanonicalEditPolicyCN"
+ graphicalNodeEditPolicyClassName="CommentGraphicalNodeEditPolicyCN"
+ createCommandClassName="CommentCreateCommandCN"
+ containers="/0/@diagram/@compartments.0 /0/@diagram/@compartments.1 /0/@diagram/@compartments.6 /0/@diagram/@compartments.7">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ definedExternally="true"
+ editHelperClassName="CommentEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.HTMLCornerBentFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusReflowableShapeEditPolicy"/>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Comment"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Element/ownedComment"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Element/ownedComment"/>
+ <modelElementInitializer
+ xsi:type="gmfgen:GenFeatureSeqInitializer">
+ <initializers
+ xsi:type="gmfgen:GenFeatureValueSpec"
+ value="/0/@expressionProviders/@providers.1/@expressions.2">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Comment/body"/>
+ </initializers>
+ </modelElementInitializer>
+ </modelFacet>
+ <labels
+ visualID="55"
+ editPartClassName="CommentBodyEditPartCN"
+ itemSemanticEditPolicyClassName="CommentBodyEditPartCN">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getCornerBentFigure"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.HTMLCornerBentFigure"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.1">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Comment/body"/>
+ </modelFacet>
+ </labels>
+ </childNodes>
+ <childNodes
+ visualID="56"
+ editPartClassName="ConstraintEditPartCN"
+ itemSemanticEditPolicyClassName="ConstraintItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="ConstraintCanonicalEditPolicyCN"
+ graphicalNodeEditPolicyClassName="ConstraintGraphicalNodeEditPolicyCN"
+ createCommandClassName="ConstraintCreateCommandCN"
+ containers="/0/@diagram/@compartments.0 /0/@diagram/@compartments.1 /0/@diagram/@compartments.6 /0/@diagram/@compartments.7">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ definedExternally="true"
+ editHelperClassName="ConstraintEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.ConstraintFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Constraint"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Namespace/ownedRule"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Namespace/ownedRule"/>
+ <modelElementInitializer
+ xsi:type="gmfgen:GenFeatureSeqInitializer">
+ <initializers
+ xsi:type="gmfgen:GenFeatureValueSpec"
+ value="/0/@expressionProviders/@providers.1/@expressions.0">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </initializers>
+ <initializers
+ xsi:type="gmfgen:GenFeatureValueSpec"
+ value="/0/@expressionProviders/@providers.1/@expressions.1">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Constraint/specification"/>
+ </initializers>
+ </modelElementInitializer>
+ </modelFacet>
+ <labels
+ visualID="57"
+ editPartClassName="ConstraintNameEditPartCN"
+ itemSemanticEditPolicyClassName="ConstraintNameItemSemanticEditPolicyCN">
+ <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"/>
+ <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="58"
+ editPartClassName="ConstraintSpecificationEditPartCN"
+ itemSemanticEditPolicyClassName="ConstraintSpecificationItemSemanticEditPolicyCN">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getConstraintFigure"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.ConstraintFigure"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.3">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Constraint/specification"/>
+ <editableMetaFeatures
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Constraint/specification"/>
+ </modelFacet>
+ </labels>
+ </childNodes>
+ <topLevelNodes
+ visualID="2011"
+ editPartClassName="DependencyNodeEditPart"
+ itemSemanticEditPolicyClassName="DependencyNodeItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="DependencyNodeCanonicalEditPolicy"
+ graphicalNodeEditPolicyClassName="DependencyNodeGraphicalNodeEditPolicy"
+ createCommandClassName="DependencyNodeCreateCommand">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.Dependency_2011"
+ displayName="DependencyNode"
+ definedExternally="true"
+ editHelperClassName="DependencyEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.DependencyNodeFigure">
+ <attributes
+ xsi:type="gmfgen:DefaultSizeAttributes"
+ width="10"
+ height="10"/>
+ </viewmap>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy"/>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Dependency"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/>
+ </modelFacet>
+ <labels
+ xsi:type="gmfgen:GenExternalNodeLabel"
+ visualID="7"
+ editPartClassName="MultiDependencyLabelEditPart"
+ itemSemanticEditPolicyClassName="MultiDependencyLabelItemSemanticEditPolicy">
+ <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>
+ </topLevelNodes>
+ <topLevelNodes
+ visualID="2010"
+ compartments="/0/@diagram/@compartments.0">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.Model_2010"
+ displayName="Model"
+ definedExternally="true"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure">
+ <attributes
+ xsi:type="gmfgen:DefaultSizeAttributes"
+ width="150"
+ height="150"/>
+ </viewmap>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;RESIZE_BORDER_ITEMS&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Model"/>
+ <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.1/@expressions.0">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </initializers>
+ </modelElementInitializer>
+ </modelFacet>
+ <labels
+ visualID="48"
+ editPartClassName="ModelNameEditPart"
+ itemSemanticEditPolicyClassName="ModelNameItemSemanticEditPolicy"
+ elementIcon="true">
+ <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"/>
+ <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>
+ <topLevelNodes
+ visualID="2009"
+ editPartClassName="PackageEditPart"
+ itemSemanticEditPolicyClassName="PackageItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="PackageCanonicalEditPolicy"
+ compartments="/0/@diagram/@compartments.1"
+ graphicalNodeEditPolicyClassName="PackageGraphicalNodeEditPolicy"
+ createCommandClassName="PackageCreateCommand">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ definedExternally="true"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure">
+ <attributes
+ xsi:type="gmfgen:DefaultSizeAttributes"
+ width="150"
+ height="150"/>
+ </viewmap>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;RESIZE_BORDER_ITEMS&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package"/>
+ <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.1/@expressions.0">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </initializers>
+ </modelElementInitializer>
+ </modelFacet>
+ <labels
+ visualID="35"
+ editPartClassName="PackageNameEditPart"
+ itemSemanticEditPolicyClassName="PackageNameItemSemanticEditPolicy"
+ elementIcon="true">
+ <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"/>
+ <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>
+ <topLevelNodes
+ visualID="2005"
+ editPartClassName="ConstraintEditPart"
+ itemSemanticEditPolicyClassName="ConstraintItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="ConstraintCanonicalEditPolicy"
+ graphicalNodeEditPolicyClassName="ConstraintGraphicalNodeEditPolicy"
+ createCommandClassName="ConstraintCreateCommand">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ definedExternally="true"
+ editHelperClassName="ConstraintEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.ConstraintFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Constraint"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Namespace/ownedRule"/>
+ <modelElementInitializer
+ xsi:type="gmfgen:GenFeatureSeqInitializer">
+ <initializers
+ xsi:type="gmfgen:GenFeatureValueSpec"
+ value="/0/@expressionProviders/@providers.1/@expressions.0">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </initializers>
+ <initializers
+ xsi:type="gmfgen:GenFeatureValueSpec"
+ value="/0/@expressionProviders/@providers.1/@expressions.1">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Constraint/specification"/>
+ </initializers>
+ </modelElementInitializer>
+ </modelFacet>
+ <labels
+ visualID="2"
+ editPartClassName="ConstraintNameEditPart"
+ itemSemanticEditPolicyClassName="ConstraintNameItemSemanticEditPolicy">
+ <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"/>
+ <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="3"
+ editPartClassName="ConstraintSpecificationEditPart"
+ itemSemanticEditPolicyClassName="ConstraintSpecificationItemSemanticEditPolicy">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getConstraintFigure"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.ConstraintFigure"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.3">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Constraint/specification"/>
+ <editableMetaFeatures
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Constraint/specification"/>
+ </modelFacet>
+ </labels>
+ </topLevelNodes>
+ <topLevelNodes
+ visualID="2001"
+ editPartClassName="CommentEditPart"
+ itemSemanticEditPolicyClassName="CommentItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="CommentCanonicalEditPolicy"
+ graphicalNodeEditPolicyClassName="CommentGraphicalNodeEditPolicy"
+ createCommandClassName="CommentCreateCommand">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ definedExternally="true"
+ editHelperClassName="CommentEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.HTMLCornerBentFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusReflowableShapeEditPolicy"/>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Comment"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Element/ownedComment"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Element/ownedComment"/>
+ <modelElementInitializer
+ xsi:type="gmfgen:GenFeatureSeqInitializer">
+ <initializers
+ xsi:type="gmfgen:GenFeatureValueSpec"
+ value="/0/@expressionProviders/@providers.1/@expressions.2">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Comment/body"/>
+ </initializers>
+ </modelElementInitializer>
+ </modelFacet>
+ <labels
+ visualID="1"
+ editPartClassName="CommentBodyEditPart"
+ itemSemanticEditPolicyClassName="CommentBodyEditPart">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getCornerBentFigure"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.HTMLCornerBentFigure"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.1">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Comment/body"/>
+ </modelFacet>
+ </labels>
+ </topLevelNodes>
+ <topLevelNodes
+ visualID="2002"
+ editPartClassName="ExecutionEnvironmentEditPart"
+ itemSemanticEditPolicyClassName="ExecutionEnvironmentItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="ExecutionEnvironmentCanonicalEditPolicy"
+ compartments="/0/@diagram/@compartments.3"
+ graphicalNodeEditPolicyClassName="ExecutionEnvironmentGraphicalNodeEditPolicy"
+ createCommandClassName="ExecutionEnvironmentCreateCommand">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ definedExternally="true"
+ editHelperClassName="ExecutionEnvironmentEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ExecutionEnvironmentFigure">
+ <attributes
+ xsi:type="gmfgen:DefaultSizeAttributes"
+ width="150"
+ height="100"/>
+ </viewmap>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;REMOVE_ORPHAN_VIEW&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;RESIZE_BORDER_ITEMS&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ExecutionEnvironment"/>
+ <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.1/@expressions.0">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </initializers>
+ </modelElementInitializer>
+ </modelFacet>
+ <labels
+ visualID="5"
+ editPartClassName="ExecutionEnvironmentNameEditPart"
+ itemSemanticEditPolicyClassName="ExecutionEnvironmentNameItemSemanticEditPolicy">
+ <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"/>
+ <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>
+ <topLevelNodes
+ visualID="2003"
+ editPartClassName="DeviceEditPart"
+ itemSemanticEditPolicyClassName="DeviceItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="DeviceCanonicalEditPolicy"
+ compartments="/0/@diagram/@compartments.2"
+ graphicalNodeEditPolicyClassName="DeviceGraphicalNodeEditPolicy"
+ createCommandClassName="DeviceCreateCommand">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ definedExternally="true"
+ editHelperClassName="DeviceEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeviceFigure">
+ <attributes
+ xsi:type="gmfgen:DefaultSizeAttributes"
+ width="150"
+ height="100"/>
+ </viewmap>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;REMOVE_ORPHAN_VIEW&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;RESIZE_BORDER_ITEMS&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Device"/>
+ <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.1/@expressions.0">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </initializers>
+ </modelElementInitializer>
+ </modelFacet>
+ <labels
+ visualID="6"
+ editPartClassName="DeviceNameEditPart"
+ itemSemanticEditPolicyClassName="DeviceNameItemSemanticEditPolicy">
+ <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"/>
+ <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>
+ <topLevelNodes
+ visualID="2006"
+ editPartClassName="ArtifactEditPart"
+ itemSemanticEditPolicyClassName="ArtifactItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="ArtifactCanonicalEditPolicy"
+ compartments="/0/@diagram/@compartments.5"
+ graphicalNodeEditPolicyClassName="ArtifactGraphicalNodeEditPolicy"
+ createCommandClassName="ArtifactCreateCommand">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ definedExternally="true"
+ editHelperClassName="ArtifactEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ArtifactFigure">
+ <attributes
+ xsi:type="gmfgen:DefaultSizeAttributes"
+ width="150"
+ height="70"/>
+ </viewmap>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;REMOVE_ORPHAN_VIEW&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.GetChildLayoutEditPolicy"/>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact"/>
+ <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.1/@expressions.0">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </initializers>
+ <initializers
+ xsi:type="gmfgen:GenFeatureValueSpec"
+ value="/0/@expressionProviders/@providers.0/@expressions.0">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact/fileName"/>
+ </initializers>
+ </modelElementInitializer>
+ </modelFacet>
+ <labels
+ visualID="8"
+ editPartClassName="ArtifactNameEditPart"
+ itemSemanticEditPolicyClassName="ArtifactNameItemSemanticEditPolicy">
+ <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"/>
+ <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="61"
+ editPartClassName="ArtifactFloatingLabelEditPart"
+ itemSemanticEditPolicyClassName="ArtifactFloatingLabelItemSemanticEditPolicy">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel">
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ x="25"/>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0"
+ viewPattern=""
+ editorPattern=""
+ editPattern="">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </topLevelNodes>
+ <topLevelNodes
+ visualID="2008"
+ compartments="/0/@diagram/@compartments.4">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ definedExternally="true"
+ editHelperClassName="NodeEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.NodeFigure">
+ <attributes
+ xsi:type="gmfgen:DefaultSizeAttributes"
+ width="150"
+ height="150"/>
+ </viewmap>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;REMOVE_ORPHAN_VIEW&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="&quot;RESIZE_BORDER_ITEMS&quot;"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Node"/>
+ <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.1/@expressions.0">
+ <feature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </initializers>
+ </modelElementInitializer>
+ </modelFacet>
+ <labels
+ visualID="9"
+ editPartClassName="NodeNameEditPart"
+ itemSemanticEditPolicyClassName="NodeNameItemSemanticEditPolicy">
+ <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"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0"
+ editPattern="">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </topLevelNodes>
+ <topLevelNodes
+ visualID="2012"
+ editPartClassName="DefaultNamedElementEditPart"
+ itemSemanticEditPolicyClassName="DefaultNamedElementItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="DefaultNamedElementCanonicalEditPolicy"
+ graphicalNodeEditPolicyClassName="DefaultNamedElementGraphicalNodeEditPolicy"
+ createCommandClassName="DefaultNamedElementCreateCommand">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.NamedElement_2012"
+ displayName="DefaultNamedElement"
+ definedExternally="true"
+ editHelperClassName="DefaultNamedElementEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure">
+ <attributes
+ xsi:type="gmfgen:DefaultSizeAttributes"
+ width="100"
+ height="50"/>
+ </viewmap>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ChangeStereotypedShapeEditPolicy.CHANGE_SHAPE_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.DeploymentDiagramChangeStereotypedShapeEditpolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.itemsemantic.CustomDefaultNamedElementItemSemanticEditPolicy"/>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/>
+ </modelFacet>
+ <labels
+ visualID="53"
+ editPartClassName="DefaultNamedElementNameEditPart"
+ itemSemanticEditPolicyClassName="DefaultNamedElementNameItemSemanticEditPolicy"
+ elementIcon="true">
+ <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"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0"
+ editPattern="">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </topLevelNodes>
+ <links
+ visualID="4005"
+ editPartClassName="LinkDescriptorEditPart"
+ itemSemanticEditPolicyClassName="LinkDescriptorItemSemanticEditPolicy"
+ createCommandClassName="LinkDescriptorCreateCommand"
+ reorientCommandClassName="LinkDescriptorReorientCommand">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
+ <elementType
+ xsi:type="gmfgen:NotationType"
+ definedExternally="true"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.edge.SimpleDashedEdgeFigure"/>
+ </links>
+ <links
+ visualID="4008"
+ editPartClassName="CommentAnnotatedElementEditPart"
+ itemSemanticEditPolicyClassName="CommentAnnotatedElementItemSemanticEditPolicy"
+ createCommandClassName="CommentAnnotatedElementCreateCommand"
+ reorientCommandClassName="CommentAnnotatedElementReorientCommand">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.CommentAnnotatedElement_4006"
+ displayName="CommentAnnotatedElement"
+ definedExternally="true"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.edge.SimpleDashedEdgeFigure"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLinkModelFacet">
+ <metaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Comment/annotatedElement"/>
+ </modelFacet>
+ </links>
+ <links
+ visualID="4009"
+ editPartClassName="ConstraintConstrainedElementEditPart"
+ itemSemanticEditPolicyClassName="ConstraintConstrainedElementItemSemanticEditPolicy"
+ createCommandClassName="ConstraintConstrainedElementCreateCommand"
+ reorientCommandClassName="ConstraintConstrainedElementReorientCommand">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.ConstraintConstrainedElement_4007"
+ displayName="ConstraintConstrainedElement"
+ definedExternally="true"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.edge.SimpleDashedEdgeFigure"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLinkModelFacet">
+ <metaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Constraint/constrainedElement"/>
+ </modelFacet>
+ </links>
+ <links
+ visualID="4001"
+ editPartClassName="DeploymentEditPart"
+ itemSemanticEditPolicyClassName="DeploymentItemSemanticEditPolicy"
+ createCommandClassName="DeploymentCreateCommand"
+ reorientCommandClassName="DeploymentReorientCommand">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ definedExternally="true"
+ editHelperClassName="DeploymentEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy"/>
+ <modelFacet
+ xsi:type="gmfgen:TypeLinkModelFacet">
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Deployment"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/DeploymentTarget/deployment"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/DeploymentTarget/deployment"/>
+ <modelElementInitializer
+ xsi:type="gmfgen:GenFeatureSeqInitializer">
+ <initializers
+ xsi:type="gmfgen:GenFeatureValueSpec"
+ value="/0/@expressionProviders/@providers.1/@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/Dependency/client"/>
+ <targetMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Dependency/supplier"/>
+ </modelFacet>
+ <labels
+ visualID="13"
+ editPartClassName="DeploymentNameEditPart"
+ itemSemanticEditPolicyClassName="DeploymentNameItemSemanticEditPolicy">
+ <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:LabelOffsetAttributes"
+ y="60"/>
+ </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
+ visualID="14"
+ editPartClassName="DeploymentAppliedStereotypeEditPart"
+ itemSemanticEditPolicyClassName="DeploymentAppliedStereotypeItemSemanticEditPolicy">
+ <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.2"
+ 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="4002"
+ editPartClassName="ManifestationEditPart"
+ itemSemanticEditPolicyClassName="ManifestationItemSemanticEditPolicy"
+ createCommandClassName="ManifestationCreateCommand"
+ reorientCommandClassName="ManifestationReorientCommand">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ definedExternally="true"
+ editHelperClassName="ManifestationEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy"/>
+ <modelFacet
+ xsi:type="gmfgen:TypeLinkModelFacet">
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Manifestation"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact/manifestation"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact/manifestation"/>
+ <modelElementInitializer
+ xsi:type="gmfgen:GenFeatureSeqInitializer">
+ <initializers
+ xsi:type="gmfgen:GenFeatureValueSpec"
+ value="/0/@expressionProviders/@providers.1/@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/Dependency/client"/>
+ <targetMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Dependency/supplier"/>
+ </modelFacet>
+ <labels
+ visualID="10"
+ editPartClassName="ManifestationNameEditPart"
+ itemSemanticEditPolicyClassName="ManifestationNameItemSemanticEditPolicy">
+ <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:LabelOffsetAttributes"
+ y="60"/>
+ </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
+ visualID="11"
+ editPartClassName="ManifestationAppliedStereotypeEditPart"
+ itemSemanticEditPolicyClassName="ManifestationAppliedStereotypeItemSemanticEditPolicy">
+ <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="30"/>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.2"
+ 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="4003"
+ editPartClassName="GeneralizationEditPart"
+ itemSemanticEditPolicyClassName="GeneralizationItemSemanticEditPolicy"
+ createCommandClassName="GeneralizationCreateCommand"
+ reorientCommandClassName="GeneralizationReorientCommand">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ definedExternally="true"
+ editHelperClassName="GeneralizationEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.edge.GeneralizationFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy"/>
+ <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"/>
+ <sourceMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Generalization/specific"/>
+ <targetMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Generalization/general"/>
+ </modelFacet>
+ <labels
+ visualID="4"
+ editPartClassName="GeneralizationAppliedStereotypeEditPart"
+ itemSemanticEditPolicyClassName="GeneralizationAppliedStereotypeItemSemanticEditPolicy"
+ 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.2"
+ 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>
+ <links
+ visualID="4004"
+ editPartClassName="DependencyEditPart"
+ itemSemanticEditPolicyClassName="DependencyItemSemanticEditPolicy"
+ createCommandClassName="DependencyCreateCommand"
+ reorientCommandClassName="DependencyReorientCommand">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ displayName="DependencyLink"
+ definedExternally="true"
+ metamodelType="/0/@diagram/@topLevelNodes.0/@elementType"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
+ <modelFacet
+ xsi:type="gmfgen:TypeLinkModelFacet">
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Dependency"/>
+ <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.1/@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/Dependency/client"/>
+ <targetMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Dependency/supplier"/>
+ </modelFacet>
+ <labels
+ visualID="12"
+ editPartClassName="DependencyNameEditPart"
+ itemSemanticEditPolicyClassName="DependencyNameItemSemanticEditPolicy">
+ <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:LabelOffsetAttributes"
+ y="40"/>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ parser="/0/@labelParsers/@implementations.0"
+ editorPattern="">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/>
+ </modelFacet>
+ </labels>
+ <labels
+ visualID="15"
+ editPartClassName="DependencyAppliedStereotypeEditPart"
+ itemSemanticEditPolicyClassName="DependencyAppliedStereotypeItemSemanticEditPolicy">
+ <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.2"
+ 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="4010"
+ editPartClassName="DependencyBranchEditPart"
+ itemSemanticEditPolicyClassName="DependencyBranchItemSemanticEditPolicy"
+ createCommandClassName="DependencyBranchCreateCommand"
+ reorientCommandClassName="DependencyBranchReorientCommand">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ uniqueIdentifier="org.eclipse.papyrus.uml.diagram.deployment.Dependency_4010"
+ displayName="DependencyBranchLink"
+ definedExternally="true"
+ metamodelType="/0/@diagram/@topLevelNodes.0/@elementType"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/>
+ <modelFacet
+ xsi:type="gmfgen:TypeLinkModelFacet">
+ <metaClass
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Dependency"/>
+ <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.1/@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/Dependency/client"/>
+ <targetMetaFeature
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Dependency/supplier"/>
+ </modelFacet>
+ </links>
+ <compartments
+ visualID="51"
+ editPartClassName="ModelPackageableElementCompartmentEditPart"
+ itemSemanticEditPolicyClassName="ModelPackageableElementCompartmentItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="ModelPackageableElementCompartmentCanonicalEditPolicy"
+ childNodes="/0/@diagram/@childNodes.0 /0/@diagram/@childNodes.1 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12"
+ title="ModelCompartment"
+ canCollapse="false"
+ node="/0/@diagram/@topLevelNodes.1"
+ listLayout="false">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getPackageableElementFigure"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ </compartments>
+ <compartments
+ visualID="38"
+ editPartClassName="PackagePackageableElementCompartmentEditPart"
+ itemSemanticEditPolicyClassName="PackagePackageableElementCompartmentItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="PackagePackageableElementCompartmentCanonicalEditPolicy"
+ childNodes="/0/@diagram/@childNodes.0 /0/@diagram/@childNodes.1 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12"
+ title="PackageableElementCompartment"
+ canCollapse="false"
+ node="/0/@diagram/@topLevelNodes.2"
+ listLayout="false">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getPackageableElementFigure"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ </compartments>
+ <compartments
+ visualID="17"
+ editPartClassName="DeviceCompositeCompartmentEditPart"
+ itemSemanticEditPolicyClassName="DeviceCompositeCompartmentItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="DeviceCompositeCompartmentCanonicalEditPolicy"
+ childNodes="/0/@diagram/@childNodes.4 /0/@diagram/@childNodes.2 /0/@diagram/@childNodes.6"
+ title="DeviceCompositeCompartment"
+ canCollapse="false"
+ node="/0/@diagram/@topLevelNodes.6"
+ listLayout="false">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getCompositeCompartmentFigure"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ </compartments>
+ <compartments
+ visualID="18"
+ editPartClassName="ExecutionEnvironmentCompositeCompartmentEditPart"
+ itemSemanticEditPolicyClassName="ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicy"
+ childNodes="/0/@diagram/@childNodes.4 /0/@diagram/@childNodes.8"
+ title="ExecutionEnvironmentCompositeCompartment"
+ canCollapse="false"
+ node="/0/@diagram/@topLevelNodes.5"
+ listLayout="false">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getCompositeCompartmentFigure"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ </compartments>
+ <compartments
+ visualID="19"
+ editPartClassName="NodeCompositeCompartmentEditPart"
+ itemSemanticEditPolicyClassName="NodeCompositeCompartmentItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="NodeCompositeCompartmentCanonicalEditPolicy"
+ childNodes="/0/@diagram/@childNodes.2 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.6"
+ title="CompositeCompartment"
+ canCollapse="false"
+ node="/0/@diagram/@topLevelNodes.8"
+ listLayout="false">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getCompositeCompartmentFigure"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ </compartments>
+ <compartments
+ visualID="26"
+ editPartClassName="ArtifactCompositeCompartmentEditPart"
+ itemSemanticEditPolicyClassName="ArtifactCompositeCompartmentItemSemanticEditPolicy"
+ canonicalEditPolicyClassName="ArtifactCompositeCompartmentCanonicalEditPolicy"
+ childNodes="/0/@diagram/@childNodes.9"
+ title="ArtifactCompositeCompartment"
+ node="/0/@diagram/@topLevelNodes.7"
+ listLayout="false">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getCompositeCompartmentFigure"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.BorderDisplayEditPolicy.BORDER_DISPLAY_EDITPOLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.BorderDisplayEditPolicy"/>
+ </compartments>
+ <compartments
+ visualID="52"
+ editPartClassName="ModelPackageableElementCompartmentEditPartCN"
+ itemSemanticEditPolicyClassName="ModelPackageableElementCompartmentItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="ModelPackageableElementCompartmentCanonicalEditPolicyCN"
+ childNodes="/0/@diagram/@childNodes.0 /0/@diagram/@childNodes.1 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12"
+ title="ModelCompartment"
+ canCollapse="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="getPackageableElementFigure"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ </compartments>
+ <compartments
+ visualID="39"
+ editPartClassName="PackagePackageableElementCompartmentEditPartCN"
+ itemSemanticEditPolicyClassName="PackagePackageableElementCompartmentItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="PackagePackageableElementCompartmentCanonicalEditPolicyCN"
+ childNodes="/0/@diagram/@childNodes.1 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12"
+ title="PackageableElementCompartment"
+ canCollapse="false"
+ node="/0/@diagram/@childNodes.1"
+ listLayout="false">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getPackageableElementFigure"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ </compartments>
+ <compartments
+ visualID="30"
+ editPartClassName="DeviceCompositeCompartmentEditPartCN"
+ itemSemanticEditPolicyClassName="DeviceCompositeCompartmentItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="DeviceCompositeCompartmentCanonicalEditPolicyCN"
+ childNodes="/0/@diagram/@childNodes.4 /0/@diagram/@childNodes.2 /0/@diagram/@childNodes.6"
+ title="DeviceCompositeCompartment"
+ node="/0/@diagram/@childNodes.3"
+ listLayout="false">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getCompositeCompartmentFigure"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ </compartments>
+ <compartments
+ visualID="31"
+ editPartClassName="ExecutionEnvironmentCompositeCompartmentEditPartCN"
+ itemSemanticEditPolicyClassName="ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicyCN"
+ childNodes="/0/@diagram/@childNodes.8 /0/@diagram/@childNodes.4"
+ title="ExecutionEnvironmentCompositeCompartment"
+ node="/0/@diagram/@childNodes.5"
+ listLayout="false">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getCompositeCompartmentFigure"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ </compartments>
+ <compartments
+ visualID="32"
+ editPartClassName="NodeCompositeCompartmentEditPartCN"
+ itemSemanticEditPolicyClassName="NodeCompositeCompartmentItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="NodeCompositeCompartmentCanonicalEditPolicyCN"
+ childNodes="/0/@diagram/@childNodes.2 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.8"
+ title="CompositeCompartment"
+ node="/0/@diagram/@childNodes.7"
+ listLayout="false">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getCompositeCompartmentFigure"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ </compartments>
+ <compartments
+ visualID="33"
+ editPartClassName="ArtifactCompositeCompartmentEditPartCN"
+ itemSemanticEditPolicyClassName="ArtifactCompositeCompartmentItemSemanticEditPolicyCN"
+ canonicalEditPolicyClassName="ArtifactCompositeCompartmentCanonicalEditPolicyCN"
+ childNodes="/0/@diagram/@childNodes.9"
+ title="ArtifactCompositeCompartment"
+ node="/0/@diagram/@childNodes.8"
+ listLayout="false">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getCompositeCompartmentFigure"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.BorderDisplayEditPolicy.BORDER_DISPLAY_EDITPOLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.BorderDisplayEditPolicy"/>
+ </compartments>
+ <compartments
+ visualID="34"
+ editPartClassName="ArtifactCompositeCompartmentEditPartACN"
+ itemSemanticEditPolicyClassName="ArtifactCompositeCompartmentItemSemanticEditPolicyACN"
+ canonicalEditPolicyClassName="ArtifactCompositeCompartmentCanonicalEditPolicyACN"
+ childNodes="/0/@diagram/@childNodes.9"
+ title="ArtifactCompositeCompartment"
+ node="/0/@diagram/@childNodes.9"
+ listLayout="false">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getCompositeCompartmentFigure"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.BorderDisplayEditPolicy.BORDER_DISPLAY_EDITPOLICY"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.BorderDisplayEditPolicy"/>
+ </compartments>
+ <palette>
+ <groups
+ title="Nodes"
+ description="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"
+ id="&quot;deployment.group.nodes&quot;"
+ collapse="true">
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Artifact"
+ description="Create new Artifact"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Artifact.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Artifact.gif"
+ createMethodName="createArtifactCreationTool"
+ id="&quot;deployment.tool.artifact&quot;"
+ genNodes="/0/@diagram/@topLevelNodes.7 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.10"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Comment"
+ description="Create new Comment"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Comment.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Comment.gif"
+ createMethodName="createCommentCreationTool"
+ id="&quot;deployment.tool.comment&quot;"
+ genNodes="/0/@diagram/@topLevelNodes.4 /0/@diagram/@childNodes.11"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Constraint"
+ description="Create new Constraint"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Constraint.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Constraint.gif"
+ createMethodName="createConstraintCreationTool"
+ id="&quot;deployment.tool.constraint&quot;"
+ genNodes="/0/@diagram/@topLevelNodes.3 /0/@diagram/@childNodes.12"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Device"
+ description="Create new Device"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Device.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Device.gif"
+ createMethodName="createDeviceCreationTool"
+ id="&quot;deployment.tool.device&quot;"
+ genNodes="/0/@diagram/@topLevelNodes.6 /0/@diagram/@childNodes.2 /0/@diagram/@childNodes.3"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Execution Environment"
+ description="Create new ExecutionEnvironment"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ExecutionEnvironment.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ExecutionEnvironment.gif"
+ createMethodName="createExecutionEnvironmentCreationTool"
+ id="&quot;deployment.tool.executionEnvironment&quot;"
+ genNodes="/0/@diagram/@topLevelNodes.5 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Model"
+ description="Create a model"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Model.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Model.gif"
+ createMethodName="createModelCreationTool"
+ genNodes="/0/@diagram/@childNodes.0 /0/@diagram/@topLevelNodes.1"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Node"
+ description="Create new Node"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Node.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Node.gif"
+ createMethodName="createNodeCreationTool"
+ id="&quot;deployment.tool.node&quot;"
+ genNodes="/0/@diagram/@topLevelNodes.8 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.7"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Package"
+ description="Create a Package"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Package.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Package.gif"
+ createMethodName="createPackageCreationTool"
+ id="&quot;deployment.tool.package&quot;"
+ genNodes="/0/@diagram/@topLevelNodes.2 /0/@diagram/@childNodes.1"/>
+ </groups>
+ <groups
+ title="Links"
+ description="Links"
+ 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="createLinksGroup"
+ id="&quot;deployment.group.links&quot;"
+ collapse="true">
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Dependency"
+ description="Create new Dependency"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Dependency.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Dependency.gif"
+ createMethodName="createDependencyCreationTool"
+ id="&quot;deployment.tool.dependency&quot;"
+ genLinks="/0/@diagram/@links.6"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="DependencyBranch"
+ description="Create a dependency branch"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Dependency.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Dependency.gif"
+ createMethodName="createDependencyBranchCreationTool"
+ id="&quot;deployment.tool.dependencybranch&quot;"
+ genLinks="/0/@diagram/@links.7"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Deployment"
+ description="Create new Deployment"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Deployment.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Deployment.gif"
+ createMethodName="createDeploymentCreationTool"
+ id="&quot;deployment.tool.deployment&quot;"
+ genLinks="/0/@diagram/@links.3"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Generalization"
+ description="Create new Generalization"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Generalization.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Generalization.gif"
+ createMethodName="createGeneralizationCreationTool"
+ id="&quot;deployment.tool.generalization&quot;"
+ genLinks="/0/@diagram/@links.5"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Link"
+ description="Create new Link (Comment / Constraint)"
+ largeIconPath="icons/obj16/Link.gif"
+ smallIconPath="icons/obj16/Link.gif"
+ createMethodName="createLinkCreationTool"
+ id="&quot;deployment.tool.link&quot;"
+ genLinks="/0/@diagram/@links.1 /0/@diagram/@links.2"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Manifestation"
+ description="Create new Manifestation"
+ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Manifestation.gif"
+ smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Manifestation.gif"
+ createMethodName="createManifestationCreationTool"
+ id="&quot;deployment.tool.manifestation&quot;"
+ genLinks="/0/@diagram/@links.4"/>
+ </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"/>
+ </preferencePages>
+ </diagram>
+ <plugin
+ iD="org.eclipse.papyrus.uml.diagram.deployment"
+ name="Papyrus Deployment Diagram "
+ provider="Eclipse Modeling Project"
+ version="1.1.0.qualifier">
+ <requiredPlugins>org.eclipse.draw2d</requiredPlugins>
+ <requiredPlugins>org.eclipse.gmf.runtime.draw2d.ui</requiredPlugins>
+ </plugin>
+ <editor
+ iconPath="icons/obj16/DeploymentDiagram.gif"/>
+ <diagramUpdater/>
+ <propertySheet>
+ <tabs
+ xsi:type="gmfgen:GenStandardPropertyTab"
+ iD="appearance"/>
+ <tabs
+ xsi:type="gmfgen:GenStandardPropertyTab"
+ iD="diagram"/>
+ <tabs
+ xsi:type="gmfgen:GenCustomPropertyTab"
+ iD="domain"
+ label="Core">
+ <filter
+ xsi:type="gmfgen:TypeTabFilter">
+ <types>org.eclipse.gmf.runtime.notation.View</types>
+ <types>org.eclipse.gef.EditPart</types>
+ <generatedTypes>abstractNavigatorItem</generatedTypes>
+ </filter>
+ </tabs>
+ </propertySheet>
+ <domainGenModel
+ href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#/"/>
+ <expressionProviders>
+ <providers
+ xsi:type="gmfgen:GenExpressionInterpreter">
+ <expressions
+ body="self.name.concat('.file') "/>
+ </providers>
+ <providers
+ xsi:type="gmfgen:GenJavaExpressionProvider"
+ injectExpressionBody="true">
+ <expressions
+ body="return org.eclipse.papyrus.uml.tools.utils.NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());"/>
+ <expressions
+ body="// Constraint specification init&#xD;&#xA;org.eclipse.uml2.uml.LiteralString value = org.eclipse.uml2.uml.UMLFactory.eINSTANCE.createLiteralString();&#xD;&#xA;value.setValue(&quot;&quot;);&#xD;&#xA;return value;"/>
+ <expressions
+ body="// Comment body init&#xD;&#xA;return &quot;&quot;;"/>
+ <expressions
+ xsi:type="gmfgen:GenConstraint"
+ body="// Creation constraint for TopLevelNodes&#xD;&#xA;&#x9;if(! (getElementToEdit() instanceof org.eclipse.uml2.uml.Package)) {&#xD;&#xA;&#x9;&#x9;return false;&#xD;&#xA;&#x9;}&#xD;&#xA;&#xD;&#xA;&#x9;return true;"/>
+ </providers>
+ </expressionProviders>
+ <labelParsers
+ extensibleViaService="true">
+ <implementations
+ xsi:type="gmfgen:PredefinedParser"
+ uses="/0/@diagram/@topLevelNodes.3/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.5/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.6/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.7/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.8/@labels.0/@modelFacet /0/@diagram/@links.4/@labels.0/@modelFacet /0/@diagram/@links.6/@labels.0/@modelFacet /0/@diagram/@links.3/@labels.0/@modelFacet /0/@diagram/@childNodes.2/@labels.0/@modelFacet /0/@diagram/@childNodes.4/@labels.0/@modelFacet /0/@diagram/@childNodes.6/@labels.0/@modelFacet /0/@diagram/@childNodes.8/@labels.0/@modelFacet /0/@diagram/@childNodes.9/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.2/@labels.0/@modelFacet /0/@diagram/@childNodes.1/@labels.0/@modelFacet /0/@diagram/@childNodes.10/@labels.0/@modelFacet /0/@diagram/@childNodes.7/@labels.0/@modelFacet /0/@diagram/@childNodes.3/@labels.0/@modelFacet /0/@diagram/@childNodes.5/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.1/@labels.0/@modelFacet /0/@diagram/@childNodes.0/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.0/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.9/@labels.0/@modelFacet /0/@diagram/@childNodes.12/@labels.0/@modelFacet /0/@diagram/@childNodes.8/@labels.1/@modelFacet /0/@diagram/@childNodes.9/@labels.1/@modelFacet /0/@diagram/@topLevelNodes.7/@labels.1/@modelFacet"/>
+ <implementations
+ xsi:type="gmfgen:CustomParser"
+ uses="/0/@diagram/@topLevelNodes.4/@labels.0/@modelFacet /0/@diagram/@childNodes.11/@labels.0/@modelFacet"
+ qualifiedName="org.eclipse.papyrus.uml.diagram.common.parser.CommentParser"/>
+ <implementations
+ xsi:type="gmfgen:CustomParser"
+ uses="/0/@diagram/@links.5/@labels.0/@modelFacet /0/@diagram/@links.4/@labels.1/@modelFacet /0/@diagram/@links.6/@labels.1/@modelFacet /0/@diagram/@links.3/@labels.1/@modelFacet"
+ qualifiedName="org.eclipse.papyrus.uml.diagram.common.parser.stereotype.AppliedStereotypeParser"/>
+ <implementations
+ xsi:type="gmfgen:CustomParser"
+ uses="/0/@diagram/@topLevelNodes.3/@labels.1/@modelFacet /0/@diagram/@childNodes.12/@labels.1/@modelFacet"
+ qualifiedName="org.eclipse.papyrus.uml.diagram.common.parser.ConstraintParser"/>
+ </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="Manages stereotype shown with External Label"
+ genView="/0/@diagram/@links.5/@labels.0 /0/@diagram/@links.3/@labels.1 /0/@diagram/@links.4/@labels.1 /0/@diagram/@links.6/@labels.1"
+ name="EP_Stereotypes_EXT_NODE"
+ superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:ExtendedGenView"
+ comment="Add super class to a Comment edit parts"
+ genView="/0/@diagram/@childNodes.11 /0/@diagram/@topLevelNodes.4"
+ name="EP_Comment_NODE"
+ superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractCommentEditPart"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:ExtendedGenView"
+ comment="Add super class to a Constraint edit parts"
+ genView="/0/@diagram/@childNodes.12 /0/@diagram/@topLevelNodes.3"
+ name="EP_Constraint_NODE"
+ superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractConstraintEditPart"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:ExtendedGenView"
+ comment="Label in charge to display applied stereotypes on links"
+ genView="/0/@diagram/@links.3 /0/@diagram/@links.4 /0/@diagram/@links.6 /0/@diagram/@links.5 /0/@diagram/@links.7 /0/@diagram/@links.2"
+ name="ExtendedUMLLinks"
+ superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.UMLConnectionNodeEditPart"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:ExtendedGenView"
+ comment="adding to manange NamedElement"
+ genView="/0/@diagram /0/@diagram/@topLevelNodes.9 /0/@diagram/@topLevelNodes.8 /0/@diagram/@childNodes.6 /0/@diagram/@topLevelNodes.6 /0/@diagram/@childNodes.2 /0/@diagram/@topLevelNodes.5 /0/@diagram/@childNodes.4"
+ name="NamedElementEditPart"
+ superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:GenNodeConstraint"
+ comment="Creation constraint for TopLevelNode in virtual canvas"
+ genNode="/0/@diagram/@topLevelNodes.2 /0/@diagram/@topLevelNodes.4 /0/@diagram/@topLevelNodes.3 /0/@diagram/@topLevelNodes.5 /0/@diagram/@topLevelNodes.6 /0/@diagram/@topLevelNodes.7 /0/@diagram/@topLevelNodes.8"
+ genConstraint="/0/@expressionProviders/@providers.1/@expressions.3"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:AdditionalEditPartCandies"
+ comment="Indicate specific BaseEditHelper in place of generated EditHelper"
+ baseEditHelperPackage="org.eclipse.papyrus.uml.diagram.common.helper"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:EditPartUsingDeleteService"
+ comment="The delete service is used on every TopNode Childnode and Link"
+ name="Every TopNode ChildNode Link"
+ genView="/0/@diagram/@topLevelNodes.0 /0/@diagram/@topLevelNodes.2 /0/@diagram/@topLevelNodes.4 /0/@diagram/@topLevelNodes.3 /0/@diagram/@topLevelNodes.5 /0/@diagram/@topLevelNodes.6 /0/@diagram/@topLevelNodes.7 /0/@diagram/@topLevelNodes.8 /0/@diagram/@childNodes.1 /0/@diagram/@links.3 /0/@diagram/@links.4 /0/@diagram/@links.5 /0/@diagram/@links.6 /0/@diagram/@links.7 /0/@diagram/@links.1 /0/@diagram/@links.2"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:EditPartUsingReorientService"
+ comment="Use the edit service for reorient command (All DirectedRelationship)"
+ name="DirectedRelationship"
+ genView="/0/@diagram/@links.3 /0/@diagram/@links.4 /0/@diagram/@links.5 /0/@diagram/@links.6 /0/@diagram/@links.7"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:LabelVisibilityPreference"
+ comment="Name"
+ role="Name"
+ linkLabels="/0/@diagram/@links.3/@labels.0 /0/@diagram/@links.4/@labels.0 /0/@diagram/@links.6/@labels.0"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:LabelVisibilityPreference"
+ comment="Stereotype"
+ role="Stereotype"
+ linkLabels="/0/@diagram/@links.5/@labels.0 /0/@diagram/@links.3/@labels.1 /0/@diagram/@links.4/@labels.1 /0/@diagram/@links.6/@labels.1"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:CompartmentTitleVisibilityPreference"
+ comment="Hidden Compartments Titles"
+ visibleByDefault="false"
+ compartments="/0/@diagram/@compartments.2 /0/@diagram/@compartments.3 /0/@diagram/@compartments.4 /0/@diagram/@compartments.5 /0/@diagram/@compartments.8 /0/@diagram/@compartments.9 /0/@diagram/@compartments.10 /0/@diagram/@compartments.11 /0/@diagram/@compartments.12 /0/@diagram/@compartments.1 /0/@diagram/@compartments.7 /0/@diagram/@compartments.0 /0/@diagram/@compartments.6"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:CompartmentVisibilityPreference"
+ comment="Hidden Compartments"
+ visibleByDefault="false"
+ compartments="/0/@diagram/@compartments.5 /0/@diagram/@compartments.11 /0/@diagram/@compartments.12"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:ExtendedGenView"
+ comment="add superclass for floating Label"
+ genView="/0/@diagram/@childNodes.9/@labels.1 /0/@diagram/@topLevelNodes.7/@labels.1 /0/@diagram/@childNodes.8/@labels.1"
+ name="FloatingLabelEditPart"
+ superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:ExtendedGenView"
+ comment=""
+ genView="/0/@diagram/@topLevelNodes.7 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.8"
+ name="RoundedCompartmentEditPart"
+ superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:SpecificLocatorExternalLabel"
+ comment="Locator for external Floating label of RoundedCompartment EP"
+ classpath="org.eclipse.papyrus.uml.diagram.common.locator.RoundedRectangleLabelPositionLocator"
+ genExternalNodeLabel="/0/@diagram/@topLevelNodes.7/@labels.1 /0/@diagram/@childNodes.9/@labels.1 /0/@diagram/@childNodes.8/@labels.1"/>
+ <extensionNodes
+ xsi:type="papyrusgmfgenextension:ExtendedGenView"
+ genView="/0/@diagram/@childNodes.1 /0/@diagram/@topLevelNodes.2 /0/@diagram/@childNodes.0 /0/@diagram/@topLevelNodes.1"
+ name="PackageEditPart"
+ superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.PackageEditPart"/>
+ </papyrusgmfgenextension:PapyrusExtensionRootNode>
+</xmi:XMI>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml
index 1e7371104ac..0ab088a38fa 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml
@@ -155,7 +155,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Artifact.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Artifact.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Comment"
@@ -165,7 +165,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Comment.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Comment.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Constraint"
@@ -175,7 +175,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Constraint.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Constraint.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Device"
@@ -185,7 +185,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Device.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Device.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new ExecutionEnvironment"
@@ -195,7 +195,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ExecutionEnvironment.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ExecutionEnvironment.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create a model"
@@ -205,7 +205,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Model.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Model.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Node"
@@ -215,7 +215,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Node.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Node.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create a Package"
@@ -225,7 +225,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Package.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Package.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Dependency"
@@ -235,7 +235,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Dependency.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Dependency.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create a dependency branch"
@@ -245,7 +245,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Dependency.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Dependency.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Deployment"
@@ -255,7 +255,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Deployment.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Deployment.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Generalization"
@@ -265,7 +265,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Generalization.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Generalization.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Link (Comment / Constraint)"
@@ -275,7 +275,7 @@
large_icon="icons/obj16/Link.gif"
path=""
small_icon="icons/obj16/Link.gif">
- </entry>
+ </entry>
<entry
defineOnly="true"
description="Create new Manifestation"
@@ -285,7 +285,7 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Manifestation.gif"
path=""
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Manifestation.gif">
- </entry>
+ </entry>
</contribution>
</paletteProvider>
@@ -531,336 +531,10 @@
<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypes" id="element-types">
<?gmfgen generated="true"?>
- <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.uml.diagram.deployment.Package_1000"
- name="%metatype.name.Package_1000"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Package"
- edithelper="org.eclipse.papyrus.uml.diagram.deployment.edit.helpers.ModelEditHelper">
- <param name="semanticHint" value="1000"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.uml.diagram.deployment.Dependency_2011"
- name="%metatype.name.Dependency_2011"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Dependency"
- edithelper="org.eclipse.papyrus.uml.diagram.deployment.edit.helpers.DependencyEditHelper">
- <param name="semanticHint" value="2011"/>
- </metamodelType>
- </metamodel>
- <specializationType
- id="org.eclipse.papyrus.uml.diagram.deployment.Model_2010"
- name="%metatype.name.Model_2010"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
- <specializes id="org.eclipse.gmf.runtime.emf.type.core.null"/>
- <param name="semanticHint" value="2010"/>
- </specializationType>
- <specializationType
- id="org.eclipse.papyrus.uml.diagram.deployment.Package_2009"
- name="%metatype.name.Package_2009"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
- <specializes id="org.eclipse.gmf.runtime.emf.type.core.null"/>
- <param name="semanticHint" value="2009"/>
- </specializationType>
- <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.uml.diagram.deployment.Constraint_2005"
- name="%metatype.name.Constraint_2005"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Constraint"
- edithelper="org.eclipse.papyrus.uml.diagram.deployment.edit.helpers.ConstraintEditHelper">
- <param name="semanticHint" value="2005"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.uml.diagram.deployment.Comment_2001"
- name="%metatype.name.Comment_2001"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Comment"
- edithelper="org.eclipse.papyrus.uml.diagram.deployment.edit.helpers.CommentEditHelper">
- <param name="semanticHint" value="2001"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_2002"
- name="%metatype.name.ExecutionEnvironment_2002"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="ExecutionEnvironment"
- edithelper="org.eclipse.papyrus.uml.diagram.deployment.edit.helpers.ExecutionEnvironmentEditHelper">
- <param name="semanticHint" value="2002"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.uml.diagram.deployment.Device_2003"
- name="%metatype.name.Device_2003"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Device"
- edithelper="org.eclipse.papyrus.uml.diagram.deployment.edit.helpers.DeviceEditHelper">
- <param name="semanticHint" value="2003"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.uml.diagram.deployment.Artifact_2006"
- name="%metatype.name.Artifact_2006"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Artifact"
- edithelper="org.eclipse.papyrus.uml.diagram.deployment.edit.helpers.ArtifactEditHelper">
- <param name="semanticHint" value="2006"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.uml.diagram.deployment.Node_2008"
- name="%metatype.name.Node_2008"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Node"
- edithelper="org.eclipse.papyrus.uml.diagram.deployment.edit.helpers.NodeEditHelper">
- <param name="semanticHint" value="2008"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.uml.diagram.deployment.NamedElement_2012"
- name="%metatype.name.NamedElement_2012"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="NamedElement"
- edithelper="org.eclipse.papyrus.uml.diagram.deployment.edit.helpers.DefaultNamedElementEditHelper">
- <param name="semanticHint" value="2012"/>
- </metamodelType>
- </metamodel>
- <specializationType
- id="org.eclipse.papyrus.uml.diagram.deployment.Model_49"
- name="%metatype.name.Model_49"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
- <specializes id="org.eclipse.gmf.runtime.emf.type.core.null"/>
- <param name="semanticHint" value="49"/>
- </specializationType>
- <specializationType
- id="org.eclipse.papyrus.uml.diagram.deployment.Package_36"
- name="%metatype.name.Package_36"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
- <specializes id="org.eclipse.gmf.runtime.emf.type.core.null"/>
- <param name="semanticHint" value="36"/>
- </specializationType>
- <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
- <specializationType
- id="org.eclipse.papyrus.uml.diagram.deployment.Device_16"
- name="%metatype.name.Device_16"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
- <specializes id="org.eclipse.papyrus.uml.diagram.deployment.Device_2003"/>
- <param name="semanticHint" value="16"/>
- </specializationType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
- <specializationType
- id="org.eclipse.papyrus.uml.diagram.deployment.Device_44"
- name="%metatype.name.Device_44"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
- <specializes id="org.eclipse.papyrus.uml.diagram.deployment.Device_2003"/>
- <param name="semanticHint" value="44"/>
- </specializationType>
- </metamodel>
- <specializationType
- id="org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_21"
- name="%metatype.name.ExecutionEnvironment_21"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
- <specializes id="org.eclipse.gmf.runtime.emf.type.core.null"/>
- <param name="semanticHint" value="21"/>
- </specializationType>
- <specializationType
- id="org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_46"
- name="%metatype.name.ExecutionEnvironment_46"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
- <specializes id="org.eclipse.gmf.runtime.emf.type.core.null"/>
- <param name="semanticHint" value="46"/>
- </specializationType>
- <specializationType
- id="org.eclipse.papyrus.uml.diagram.deployment.Node_23"
- name="%metatype.name.Node_23"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
- <specializes id="org.eclipse.gmf.runtime.emf.type.core.null"/>
- <param name="semanticHint" value="23"/>
- </specializationType>
- <specializationType
- id="org.eclipse.papyrus.uml.diagram.deployment.Node_42"
- name="%metatype.name.Node_42"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
- <specializes id="org.eclipse.gmf.runtime.emf.type.core.null"/>
- <param name="semanticHint" value="42"/>
- </specializationType>
- <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
- <specializationType
- id="org.eclipse.papyrus.uml.diagram.deployment.Artifact_25"
- name="%metatype.name.Artifact_25"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
- <specializes id="org.eclipse.papyrus.uml.diagram.deployment.Artifact_2006"/>
- <param name="semanticHint" value="25"/>
- </specializationType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
- <specializationType
- id="org.eclipse.papyrus.uml.diagram.deployment.Artifact_28"
- name="%metatype.name.Artifact_28"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
- <specializes id="org.eclipse.papyrus.uml.diagram.deployment.Artifact_2006"/>
- <param name="semanticHint" value="28"/>
- </specializationType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
- <specializationType
- id="org.eclipse.papyrus.uml.diagram.deployment.Artifact_40"
- name="%metatype.name.Artifact_40"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
- <specializes id="org.eclipse.papyrus.uml.diagram.deployment.Artifact_2006"/>
- <param name="semanticHint" value="40"/>
- </specializationType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.uml.diagram.deployment.Comment_54"
- name="%metatype.name.Comment_54"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Comment"
- edithelper="org.eclipse.papyrus.uml.diagram.deployment.edit.helpers.CommentEditHelper">
- <param name="semanticHint" value="54"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.uml.diagram.deployment.Constraint_56"
- name="%metatype.name.Constraint_56"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Constraint"
- edithelper="org.eclipse.papyrus.uml.diagram.deployment.edit.helpers.ConstraintEditHelper">
- <param name="semanticHint" value="56"/>
- </metamodelType>
- </metamodel>
- <specializationType
- id="org.eclipse.papyrus.uml.diagram.deployment.Link_4005"
- name="%metatype.name.Link_4005"
- kind="org.eclipse.gmf.runtime.diagram.ui.util.INotationType">
- <specializes id="org.eclipse.gmf.runtime.emf.type.core.null"/>
- <param name="semanticHint" value="4005"/>
- </specializationType>
- <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
- <specializationType
- id="org.eclipse.papyrus.uml.diagram.deployment.CommentAnnotatedElement_4006"
- name="%metatype.name.CommentAnnotatedElement_4008"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
- <specializes id="org.eclipse.gmf.runtime.emf.type.core.null"/>
- <param name="semanticHint" value="4008"/>
- </specializationType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
- <specializationType
- id="org.eclipse.papyrus.uml.diagram.deployment.ConstraintConstrainedElement_4007"
- name="%metatype.name.ConstraintConstrainedElement_4009"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
- <specializes id="org.eclipse.gmf.runtime.emf.type.core.null"/>
- <param name="semanticHint" value="4009"/>
- </specializationType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.uml.diagram.deployment.Deployment_4001"
- name="%metatype.name.Deployment_4001"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Deployment"
- edithelper="org.eclipse.papyrus.uml.diagram.deployment.edit.helpers.DeploymentEditHelper">
- <param name="semanticHint" value="4001"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.uml.diagram.deployment.Manifestation_4002"
- name="%metatype.name.Manifestation_4002"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Manifestation"
- edithelper="org.eclipse.papyrus.uml.diagram.deployment.edit.helpers.ManifestationEditHelper">
- <param name="semanticHint" value="4002"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
- <metamodelType
- id="org.eclipse.papyrus.uml.diagram.deployment.Generalization_4003"
- name="%metatype.name.Generalization_4003"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
- eclass="Generalization"
- edithelper="org.eclipse.papyrus.uml.diagram.deployment.edit.helpers.GeneralizationEditHelper">
- <param name="semanticHint" value="4003"/>
- </metamodelType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
- <specializationType
- id="org.eclipse.papyrus.uml.diagram.deployment.Dependency_4004"
- name="%metatype.name.Dependency_4004"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
- <specializes id="org.eclipse.papyrus.uml.diagram.deployment.Dependency_2011"/>
- <param name="semanticHint" value="4004"/>
- </specializationType>
- </metamodel>
- <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML">
- <specializationType
- id="org.eclipse.papyrus.uml.diagram.deployment.Dependency_4010"
- name="%metatype.name.Dependency_4010"
- kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
- <specializes id="org.eclipse.papyrus.uml.diagram.deployment.Dependency_2011"/>
- <param name="semanticHint" value="4010"/>
- </specializationType>
- </metamodel>
</extension>
<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings" id="element-types-bindings">
<?gmfgen generated="true"?>
- <clientContext id="org.eclipse.papyrus.uml.diagram.deployment.TypeContext">
- <enablement>
- <test
- property="org.eclipse.gmf.runtime.emf.core.editingDomain"
- value="org.eclipse.papyrus.uml.diagram.deployment.EditingDomain"/>
- </enablement>
- </clientContext>
- <binding context="org.eclipse.papyrus.uml.diagram.deployment.TypeContext">
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Package_1000"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Dependency_2011"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Model_2010"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Package_2009"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Constraint_2005"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Comment_2001"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_2002"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Device_2003"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Artifact_2006"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Node_2008"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.NamedElement_2012"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Model_49"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Package_36"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Device_16"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Device_44"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_21"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_46"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Node_23"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Node_42"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Artifact_25"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Artifact_28"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Artifact_40"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Comment_54"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Constraint_56"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Link_4005"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.CommentAnnotatedElement_4006"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.ConstraintConstrainedElement_4007"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Deployment_4001"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Manifestation_4002"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Generalization_4003"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Dependency_4004"/>
- <elementType ref="org.eclipse.papyrus.uml.diagram.deployment.Dependency_4010"/>
- <advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
- </binding>
</extension>
@@ -889,97 +563,90 @@
<?gmfgen generated="true"?>
</extension>
-<extension point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping">
+<extension point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping">
<?gmfgen generated="true"?>
- <diagramMappings diagramID="PapyrusUMLDeploymentDiagram">
- <mapping type="PapyrusUMLDeploymentDiagram" humanReadableType="DeploymentDiagram"/>
-
- <mapping
- humanReadableType="Model"
- type="51">
- </mapping>
- <mapping
- humanReadableType="PackageableElement"
- type="38">
- </mapping>
- <mapping
- humanReadableType="DeviceComposite"
- type="17">
- </mapping>
- <mapping
- humanReadableType="ExecutionEnvironmentComposite"
- type="18">
- </mapping>
- <mapping
- humanReadableType="Composite"
- type="19">
- </mapping>
-
- <mapping
- humanReadableType="ArtifactComposite"
- type="26">
- </mapping>
- <mapping
- humanReadableType="Model"
- type="52">
- </mapping>
-
- <mapping
- humanReadableType="PackageableElement"
- type="39">
- </mapping>
-
- <mapping
- humanReadableType="DeviceComposite"
- type="30">
- </mapping>
- <mapping
- humanReadableType="ExecutionEnvironmentComposite"
- type="31">
- </mapping>
-
- <mapping
- humanReadableType="Composite"
- type="32">
- </mapping>
- <mapping
- humanReadableType="ArtifactComposite"
- type="33">
- </mapping>
- <mapping
- humanReadableType="ArtifactComposite"
- type="34">
- </mapping>
- <mapping
- humanReadableType="Name"
- type="13">
- </mapping>
-
- <mapping
- humanReadableType="Stereotype"
- type="14">
- </mapping>
- <mapping
- humanReadableType="Name"
- type="10">
- </mapping>
-
- <mapping
- humanReadableType="Stereotype"
- type="11">
- </mapping>
- <mapping
- humanReadableType="Stereotype"
- type="4">
- </mapping>
- <mapping
- humanReadableType="Name"
- type="12">
- </mapping>
- <mapping
- humanReadableType="Stereotype"
- type="15">
- </mapping>
+ <diagramMappings diagramID="PapyrusUMLDeploymentDiagram">
+ <mapping type="PapyrusUMLDeploymentDiagram" humanReadableType="DeploymentDiagram"/>
+ <mapping
+ humanReadableType="Model"
+ type="51">
+ </mapping>
+ <mapping
+ humanReadableType="PackageableElement"
+ type="38">
+ </mapping>
+ <mapping
+ humanReadableType="DeviceComposite"
+ type="17">
+ </mapping>
+ <mapping
+ humanReadableType="ExecutionEnvironmentComposite"
+ type="18">
+ </mapping>
+ <mapping
+ humanReadableType="Composite"
+ type="19">
+ </mapping>
+ <mapping
+ humanReadableType="ArtifactComposite"
+ type="26">
+ </mapping>
+ <mapping
+ humanReadableType="Model"
+ type="52">
+ </mapping>
+ <mapping
+ humanReadableType="PackageableElement"
+ type="39">
+ </mapping>
+ <mapping
+ humanReadableType="DeviceComposite"
+ type="30">
+ </mapping>
+ <mapping
+ humanReadableType="ExecutionEnvironmentComposite"
+ type="31">
+ </mapping>
+ <mapping
+ humanReadableType="Composite"
+ type="32">
+ </mapping>
+ <mapping
+ humanReadableType="ArtifactComposite"
+ type="33">
+ </mapping>
+ <mapping
+ humanReadableType="ArtifactComposite"
+ type="34">
+ </mapping>
+ <mapping
+ humanReadableType="Name"
+ type="13">
+ </mapping>
+ <mapping
+ humanReadableType="Stereotype"
+ type="14">
+ </mapping>
+ <mapping
+ humanReadableType="Name"
+ type="10">
+ </mapping>
+ <mapping
+ humanReadableType="Stereotype"
+ type="11">
+ </mapping>
+ <mapping
+ humanReadableType="Stereotype"
+ type="4">
+ </mapping>
+ <mapping
+ humanReadableType="Name"
+ type="12">
+ </mapping>
+ <mapping
+ humanReadableType="Stereotype"
+ type="15">
+ </mapping>
<mapping
humanReadableType="Floating Label"
type="59">
@@ -1014,6 +681,12 @@
target="1.1.0">
</diagramReconciler>
</extension>
-
+<extension
+ point="org.eclipse.papyrus.infra.elementtypesconfigurations.elementTypeSetConfiguration">
+ <elementTypeSet
+ id="org.eclipse.papyrus.uml.diagram.deployment.elementTypeSet"
+ path="model/DeploymentDiagram.elementtypesconfigurations">
+ </elementTypeSet>
+</extension>
<!-- optionally, specify keybindings -->
</plugin>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ArtifactCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ArtifactCreateCommand.java
deleted file mode 100644
index 6c30c2813b0..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ArtifactCreateCommand.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Artifact;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ArtifactCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public ArtifactCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getArtifact());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Artifact newElement = UMLFactory.eINSTANCE.createArtifact();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_Artifact_2006(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Artifact 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);
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ArtifactCreateCommandACN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ArtifactCreateCommandACN.java
deleted file mode 100644
index d56d37c100b..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ArtifactCreateCommandACN.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Artifact;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ArtifactCreateCommandACN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public ArtifactCreateCommandACN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getArtifact());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Artifact newElement = UMLFactory.eINSTANCE.createArtifact();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Artifact qualifiedTarget = (Artifact) target;
- qualifiedTarget.getNestedArtifacts()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_Artifact_28(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Artifact 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);
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ArtifactCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ArtifactCreateCommandCN.java
deleted file mode 100644
index dcc4fc67f39..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ArtifactCreateCommandCN.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Artifact;
-import org.eclipse.uml2.uml.Class;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ArtifactCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public ArtifactCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getArtifact());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Artifact newElement = UMLFactory.eINSTANCE.createArtifact();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Class qualifiedTarget = (Class) target;
- qualifiedTarget.getNestedClassifiers()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_Artifact_25(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Artifact 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);
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentAnnotatedElementCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentAnnotatedElementCreateCommand.java
deleted file mode 100644
index fba2bd809fb..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentAnnotatedElementCreateCommand.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.CreateRelationshipRequest;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLBaseItemSemanticEditPolicy;
-import org.eclipse.uml2.uml.Comment;
-import org.eclipse.uml2.uml.Element;
-
-/**
- * @generated
- */
-public class CommentAnnotatedElementCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- protected final EObject source;
-
- /**
- * @generated
- */
- protected final EObject target;
-
- /**
- * @generated
- */
- public CommentAnnotatedElementCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
- super(request.getLabel(), null, request);
- this.source = source;
- this.target = target;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- if (source == null && target == null) {
- return false;
- }
- if (source != null && false == source instanceof Comment) {
- return false;
- }
- if (target != null && false == target instanceof Element) {
- return false;
- }
- if (getSource() == null) {
- return true; // link creation is in progress; source is not defined yet
- }
- // target may be null here but it's possible to check constraint
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canCreateCommentAnnotatedElement_4008(getSource(), getTarget());
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- if (!canExecute()) {
- throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
- }
-
- if (getSource() != null && getTarget() != null) {
- getSource().getAnnotatedElements()
- .add(getTarget());
- }
- return CommandResult.newOKCommandResult();
-
- }
-
- /**
- * @generated
- */
- @Override
- protected void setElementToEdit(EObject element) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @generated
- */
- protected Comment getSource() {
- return (Comment) source;
- }
-
- /**
- * @generated
- */
- protected Element getTarget() {
- return (Element) target;
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentAnnotatedElementReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentAnnotatedElementReorientCommand.java
deleted file mode 100644
index d52203e6ca5..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentAnnotatedElementReorientCommand.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLBaseItemSemanticEditPolicy;
-import org.eclipse.uml2.uml.Comment;
-import org.eclipse.uml2.uml.Element;
-
-/**
- * @generated
- */
-public class CommentAnnotatedElementReorientCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private final int reorientDirection;
-
- /**
- * @generated
- */
- private final EObject referenceOwner;
-
- /**
- * @generated
- */
- private final EObject oldEnd;
-
- /**
- * @generated
- */
- private final EObject newEnd;
-
- /**
- * @generated
- */
- public CommentAnnotatedElementReorientCommand(ReorientReferenceRelationshipRequest request) {
- super(request.getLabel(), null, request);
- reorientDirection = request.getDirection();
- referenceOwner = request.getReferenceOwner();
- oldEnd = request.getOldRelationshipEnd();
- newEnd = request.getNewRelationshipEnd();
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- if (false == referenceOwner instanceof Comment) {
- return false;
- }
- if (reorientDirection == ReorientRequest.REORIENT_SOURCE) {
- return canReorientSource();
- }
- if (reorientDirection == ReorientRequest.REORIENT_TARGET) {
- return canReorientTarget();
- }
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean canReorientSource() {
- if (!(oldEnd instanceof Element && newEnd instanceof Comment)) {
- return false;
- }
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistCommentAnnotatedElement_4008(getNewSource(), getOldTarget());
- }
-
- /**
- * @generated
- */
- protected boolean canReorientTarget() {
- if (!(oldEnd instanceof Element && newEnd instanceof Element)) {
- return false;
- }
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistCommentAnnotatedElement_4008(getOldSource(), getNewTarget());
- }
-
- /**
- * @generated
- */
- @Override
- 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 == ReorientRequest.REORIENT_SOURCE) {
- return reorientSource();
- }
- if (reorientDirection == ReorientRequest.REORIENT_TARGET) {
- return reorientTarget();
- }
- throw new IllegalStateException();
- }
-
- /**
- * @generated
- */
- protected CommandResult reorientSource() throws ExecutionException {
- getOldSource().getAnnotatedElements()
- .remove(getOldTarget());
- getNewSource().getAnnotatedElements()
- .add(getOldTarget());
- return CommandResult.newOKCommandResult(referenceOwner);
- }
-
- /**
- * @generated
- */
- protected CommandResult reorientTarget() throws ExecutionException {
- getOldSource().getAnnotatedElements()
- .remove(getOldTarget());
- getOldSource().getAnnotatedElements()
- .add(getNewTarget());
- return CommandResult.newOKCommandResult(referenceOwner);
- }
-
- /**
- * @generated
- */
- protected Comment getOldSource() {
- return (Comment) referenceOwner;
- }
-
- /**
- * @generated
- */
- protected Comment getNewSource() {
- return (Comment) newEnd;
- }
-
- /**
- * @generated
- */
- protected Element getOldTarget() {
- return (Element) oldEnd;
- }
-
- /**
- * @generated
- */
- protected Element getNewTarget() {
- return (Element) newEnd;
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentCreateCommand.java
deleted file mode 100644
index f0c232e38f1..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentCreateCommand.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Comment;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class CommentCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public CommentCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComment());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Comment newElement = UMLFactory.eINSTANCE.createComment();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Element qualifiedTarget = (Element) target;
- qualifiedTarget.getOwnedComments()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_Comment_2001(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Comment 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);
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentCreateCommandCN.java
deleted file mode 100644
index fe0fcfaa426..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentCreateCommandCN.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Comment;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class CommentCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public CommentCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComment());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Comment newElement = UMLFactory.eINSTANCE.createComment();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Element qualifiedTarget = (Element) target;
- qualifiedTarget.getOwnedComments()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_Comment_54(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Comment 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);
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintConstrainedElementCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintConstrainedElementCreateCommand.java
deleted file mode 100644
index 9935c03460b..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintConstrainedElementCreateCommand.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.CreateRelationshipRequest;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLBaseItemSemanticEditPolicy;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.Element;
-
-/**
- * @generated
- */
-public class ConstraintConstrainedElementCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- protected final EObject source;
-
- /**
- * @generated
- */
- protected final EObject target;
-
- /**
- * @generated
- */
- public ConstraintConstrainedElementCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
- super(request.getLabel(), null, request);
- this.source = source;
- this.target = target;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- if (source == null && target == null) {
- return false;
- }
- if (source != null && false == source instanceof Constraint) {
- return false;
- }
- if (target != null && false == target instanceof Element) {
- return false;
- }
- if (getSource() == null) {
- return true; // link creation is in progress; source is not defined yet
- }
- // target may be null here but it's possible to check constraint
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canCreateConstraintConstrainedElement_4009(getSource(), getTarget());
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- if (!canExecute()) {
- throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
- }
-
- if (getSource() != null && getTarget() != null) {
- getSource().getConstrainedElements()
- .add(getTarget());
- }
- return CommandResult.newOKCommandResult();
-
- }
-
- /**
- * @generated
- */
- @Override
- protected void setElementToEdit(EObject element) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @generated
- */
- protected Constraint getSource() {
- return (Constraint) source;
- }
-
- /**
- * @generated
- */
- protected Element getTarget() {
- return (Element) target;
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintConstrainedElementReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintConstrainedElementReorientCommand.java
deleted file mode 100644
index eada99ceca9..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintConstrainedElementReorientCommand.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLBaseItemSemanticEditPolicy;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.Element;
-
-/**
- * @generated
- */
-public class ConstraintConstrainedElementReorientCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private final int reorientDirection;
-
- /**
- * @generated
- */
- private final EObject referenceOwner;
-
- /**
- * @generated
- */
- private final EObject oldEnd;
-
- /**
- * @generated
- */
- private final EObject newEnd;
-
- /**
- * @generated
- */
- public ConstraintConstrainedElementReorientCommand(ReorientReferenceRelationshipRequest request) {
- super(request.getLabel(), null, request);
- reorientDirection = request.getDirection();
- referenceOwner = request.getReferenceOwner();
- oldEnd = request.getOldRelationshipEnd();
- newEnd = request.getNewRelationshipEnd();
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- if (false == referenceOwner instanceof Constraint) {
- return false;
- }
- if (reorientDirection == ReorientRequest.REORIENT_SOURCE) {
- return canReorientSource();
- }
- if (reorientDirection == ReorientRequest.REORIENT_TARGET) {
- return canReorientTarget();
- }
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean canReorientSource() {
- if (!(oldEnd instanceof Element && newEnd instanceof Constraint)) {
- return false;
- }
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistConstraintConstrainedElement_4009(getNewSource(), getOldTarget());
- }
-
- /**
- * @generated
- */
- protected boolean canReorientTarget() {
- if (!(oldEnd instanceof Element && newEnd instanceof Element)) {
- return false;
- }
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistConstraintConstrainedElement_4009(getOldSource(), getNewTarget());
- }
-
- /**
- * @generated
- */
- @Override
- 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 == ReorientRequest.REORIENT_SOURCE) {
- return reorientSource();
- }
- if (reorientDirection == ReorientRequest.REORIENT_TARGET) {
- return reorientTarget();
- }
- throw new IllegalStateException();
- }
-
- /**
- * @generated
- */
- protected CommandResult reorientSource() throws ExecutionException {
- getOldSource().getConstrainedElements()
- .remove(getOldTarget());
- getNewSource().getConstrainedElements()
- .add(getOldTarget());
- return CommandResult.newOKCommandResult(referenceOwner);
- }
-
- /**
- * @generated
- */
- protected CommandResult reorientTarget() throws ExecutionException {
- getOldSource().getConstrainedElements()
- .remove(getOldTarget());
- getOldSource().getConstrainedElements()
- .add(getNewTarget());
- return CommandResult.newOKCommandResult(referenceOwner);
- }
-
- /**
- * @generated
- */
- protected Constraint getOldSource() {
- return (Constraint) referenceOwner;
- }
-
- /**
- * @generated
- */
- protected Constraint getNewSource() {
- return (Constraint) newEnd;
- }
-
- /**
- * @generated
- */
- protected Element getOldTarget() {
- return (Element) oldEnd;
- }
-
- /**
- * @generated
- */
- protected Element getNewTarget() {
- return (Element) newEnd;
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintCreateCommand.java
deleted file mode 100644
index 7c2d748380a..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintCreateCommand.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.Namespace;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ConstraintCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public ConstraintCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getConstraint());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Constraint newElement = UMLFactory.eINSTANCE.createConstraint();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
- Namespace childHolder = (Namespace) getElementToEdit();
- childHolder.getOwnedRules()
- .add(newElement);
-
- ElementInitializers.getInstance().init_Constraint_2005(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Constraint 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);
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintCreateCommandCN.java
deleted file mode 100644
index 9586e5d92c5..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintCreateCommandCN.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.Namespace;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ConstraintCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public ConstraintCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getConstraint());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Constraint newElement = UMLFactory.eINSTANCE.createConstraint();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Namespace qualifiedTarget = (Namespace) target;
- qualifiedTarget.getOwnedRules()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_Constraint_56(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Constraint 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);
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DefaultNamedElementCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DefaultNamedElementCreateCommand.java
deleted file mode 100644
index 1cd8fbc0022..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DefaultNamedElementCreateCommand.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class DefaultNamedElementCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public DefaultNamedElementCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getNamedElement());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- throw new UnsupportedOperationException("Unimplemented operation (abstract domain element).");
- }
-
- /**
- * @generated
- */
- protected void doConfigure(NamedElement 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);
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyBranchCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyBranchCreateCommand.java
deleted file mode 100644
index 4933a1fdde5..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyBranchCreateCommand.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLBaseItemSemanticEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Dependency;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class DependencyBranchCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- protected final EObject source;
-
- /**
- * @generated
- */
- protected final EObject target;
-
- /**
- * @generated
- */
- protected Package container;
-
- /**
- * @generated
- */
- public DependencyBranchCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
- super(request.getLabel(), null, request);
- this.source = source;
- this.target = target;
- container = deduceContainer(source, target);
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- if (source == null && target == null) {
- return false;
- }
- if (source != null && false == source instanceof NamedElement) {
- return false;
- }
- if (target != null && false == target instanceof NamedElement) {
- 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().canCreateDependency_4010(getContainer(), getSource(), getTarget());
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- if (!canExecute()) {
- throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
- }
-
- Dependency newElement = UMLFactory.eINSTANCE.createDependency();
- getContainer().getPackagedElements()
- .add(newElement);
- newElement.getClients()
- .add(getSource());
- newElement.getSuppliers()
- .add(getTarget());
- ElementInitializers.getInstance().init_Dependency_4010(newElement);
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
-
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Dependency 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
- */
- @Override
- protected void setElementToEdit(EObject element) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @generated
- */
- protected NamedElement getSource() {
- return (NamedElement) source;
- }
-
- /**
- * @generated
- */
- protected NamedElement getTarget() {
- return (NamedElement) target;
- }
-
- /**
- * @generated
- */
- public Package getContainer() {
- return container;
- }
-
- /**
- * Default approach is to traverse ancestors of the source to find instance of container.
- * Modify with appropriate logic.
- *
- * @generated
- */
- protected Package 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 Package) {
- return (Package) element;
- }
- }
- return null;
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyBranchReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyBranchReorientCommand.java
deleted file mode 100644
index 4c3da9a962c..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyBranchReorientCommand.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLBaseItemSemanticEditPolicy;
-import org.eclipse.uml2.uml.Dependency;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Package;
-
-/**
- * @generated
- */
-public class DependencyBranchReorientCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private final int reorientDirection;
-
- /**
- * @generated
- */
- private final EObject oldEnd;
-
- /**
- * @generated
- */
- private final EObject newEnd;
-
- /**
- * @generated
- */
- public DependencyBranchReorientCommand(ReorientRelationshipRequest request) {
- super(request.getLabel(), request.getRelationship(), request);
- reorientDirection = request.getDirection();
- oldEnd = request.getOldRelationshipEnd();
- newEnd = request.getNewRelationshipEnd();
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- if (false == getElementToEdit() instanceof Dependency) {
- return false;
- }
- if (reorientDirection == ReorientRequest.REORIENT_SOURCE) {
- return canReorientSource();
- }
- if (reorientDirection == ReorientRequest.REORIENT_TARGET) {
- return canReorientTarget();
- }
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean canReorientSource() {
- if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
- return false;
- }
- if (getLink().getSuppliers()
- .size() != 1) {
- return false;
- }
- NamedElement target = getLink().getSuppliers()
- .get(0);
- if (!(getLink().eContainer() instanceof Package)) {
- return false;
- }
- Package container = (Package) getLink().eContainer();
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistDependency_4010(container, getLink(), getNewSource(), target);
- }
-
- /**
- * @generated
- */
- protected boolean canReorientTarget() {
- if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
- return false;
- }
- if (getLink().getClients()
- .size() != 1) {
- return false;
- }
- NamedElement source = getLink().getClients()
- .get(0);
- if (!(getLink().eContainer() instanceof Package)) {
- return false;
- }
- Package container = (Package) getLink().eContainer();
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistDependency_4010(container, getLink(), source, getNewTarget());
- }
-
- /**
- * @generated
- */
- @Override
- 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 == ReorientRequest.REORIENT_SOURCE) {
- return reorientSource();
- }
- if (reorientDirection == ReorientRequest.REORIENT_TARGET) {
- return reorientTarget();
- }
- throw new IllegalStateException();
- }
-
- /**
- * @generated
- */
- protected CommandResult reorientSource() throws ExecutionException {
- getLink().getClients()
- .remove(getOldSource());
- getLink().getClients()
- .add(getNewSource());
- return CommandResult.newOKCommandResult(getLink());
- }
-
- /**
- * @generated
- */
- protected CommandResult reorientTarget() throws ExecutionException {
- getLink().getSuppliers()
- .remove(getOldTarget());
- getLink().getSuppliers()
- .add(getNewTarget());
- return CommandResult.newOKCommandResult(getLink());
- }
-
- /**
- * @generated
- */
- protected Dependency getLink() {
- return (Dependency) getElementToEdit();
- }
-
- /**
- * @generated
- */
- protected NamedElement getOldSource() {
- return (NamedElement) oldEnd;
- }
-
- /**
- * @generated
- */
- protected NamedElement getNewSource() {
- return (NamedElement) newEnd;
- }
-
- /**
- * @generated
- */
- protected NamedElement getOldTarget() {
- return (NamedElement) oldEnd;
- }
-
- /**
- * @generated
- */
- protected NamedElement getNewTarget() {
- return (NamedElement) newEnd;
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyCreateCommand.java
deleted file mode 100644
index 038a9c2d543..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyCreateCommand.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLBaseItemSemanticEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Dependency;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class DependencyCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- protected final EObject source;
-
- /**
- * @generated
- */
- protected final EObject target;
-
- /**
- * @generated
- */
- protected Package container;
-
- /**
- * @generated
- */
- public DependencyCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
- super(request.getLabel(), null, request);
- this.source = source;
- this.target = target;
- container = deduceContainer(source, target);
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- if (source == null && target == null) {
- return false;
- }
- if (source != null && false == source instanceof NamedElement) {
- return false;
- }
- if (target != null && false == target instanceof NamedElement) {
- 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().canCreateDependency_4004(getContainer(), getSource(), getTarget());
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- if (!canExecute()) {
- throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
- }
-
- Dependency newElement = UMLFactory.eINSTANCE.createDependency();
- getContainer().getPackagedElements()
- .add(newElement);
- newElement.getClients()
- .add(getSource());
- newElement.getSuppliers()
- .add(getTarget());
- ElementInitializers.getInstance().init_Dependency_4004(newElement);
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
-
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Dependency 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
- */
- @Override
- protected void setElementToEdit(EObject element) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @generated
- */
- protected NamedElement getSource() {
- return (NamedElement) source;
- }
-
- /**
- * @generated
- */
- protected NamedElement getTarget() {
- return (NamedElement) target;
- }
-
- /**
- * @generated
- */
- public Package getContainer() {
- return container;
- }
-
- /**
- * Default approach is to traverse ancestors of the source to find instance of container.
- * Modify with appropriate logic.
- *
- * @generated
- */
- protected Package 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 Package) {
- return (Package) element;
- }
- }
- return null;
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyNodeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyNodeCreateCommand.java
deleted file mode 100644
index 1dd0bc440f1..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyNodeCreateCommand.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.uml2.uml.Dependency;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class DependencyNodeCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public DependencyNodeCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDependency());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Dependency newElement = UMLFactory.eINSTANCE.createDependency();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Dependency 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);
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyReorientCommand.java
deleted file mode 100644
index 258ae09f699..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyReorientCommand.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLBaseItemSemanticEditPolicy;
-import org.eclipse.uml2.uml.Dependency;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Package;
-
-/**
- * @generated
- */
-public class DependencyReorientCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private final int reorientDirection;
-
- /**
- * @generated
- */
- private final EObject oldEnd;
-
- /**
- * @generated
- */
- private final EObject newEnd;
-
- /**
- * @generated
- */
- public DependencyReorientCommand(ReorientRelationshipRequest request) {
- super(request.getLabel(), request.getRelationship(), request);
- reorientDirection = request.getDirection();
- oldEnd = request.getOldRelationshipEnd();
- newEnd = request.getNewRelationshipEnd();
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- if (false == getElementToEdit() instanceof Dependency) {
- return false;
- }
- if (reorientDirection == ReorientRequest.REORIENT_SOURCE) {
- return canReorientSource();
- }
- if (reorientDirection == ReorientRequest.REORIENT_TARGET) {
- return canReorientTarget();
- }
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean canReorientSource() {
- if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
- return false;
- }
- if (getLink().getSuppliers()
- .size() != 1) {
- return false;
- }
- NamedElement target = getLink().getSuppliers()
- .get(0);
- if (!(getLink().eContainer() instanceof Package)) {
- return false;
- }
- Package container = (Package) getLink().eContainer();
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistDependency_4004(container, getLink(), getNewSource(), target);
- }
-
- /**
- * @generated
- */
- protected boolean canReorientTarget() {
- if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
- return false;
- }
- if (getLink().getClients()
- .size() != 1) {
- return false;
- }
- NamedElement source = getLink().getClients()
- .get(0);
- if (!(getLink().eContainer() instanceof Package)) {
- return false;
- }
- Package container = (Package) getLink().eContainer();
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistDependency_4004(container, getLink(), source, getNewTarget());
- }
-
- /**
- * @generated
- */
- @Override
- 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 == ReorientRequest.REORIENT_SOURCE) {
- return reorientSource();
- }
- if (reorientDirection == ReorientRequest.REORIENT_TARGET) {
- return reorientTarget();
- }
- throw new IllegalStateException();
- }
-
- /**
- * @generated
- */
- protected CommandResult reorientSource() throws ExecutionException {
- getLink().getClients()
- .remove(getOldSource());
- getLink().getClients()
- .add(getNewSource());
- return CommandResult.newOKCommandResult(getLink());
- }
-
- /**
- * @generated
- */
- protected CommandResult reorientTarget() throws ExecutionException {
- getLink().getSuppliers()
- .remove(getOldTarget());
- getLink().getSuppliers()
- .add(getNewTarget());
- return CommandResult.newOKCommandResult(getLink());
- }
-
- /**
- * @generated
- */
- protected Dependency getLink() {
- return (Dependency) getElementToEdit();
- }
-
- /**
- * @generated
- */
- protected NamedElement getOldSource() {
- return (NamedElement) oldEnd;
- }
-
- /**
- * @generated
- */
- protected NamedElement getNewSource() {
- return (NamedElement) newEnd;
- }
-
- /**
- * @generated
- */
- protected NamedElement getOldTarget() {
- return (NamedElement) oldEnd;
- }
-
- /**
- * @generated
- */
- protected NamedElement getNewTarget() {
- return (NamedElement) newEnd;
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeploymentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeploymentCreateCommand.java
deleted file mode 100644
index 86e297b18b0..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeploymentCreateCommand.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLBaseItemSemanticEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Deployment;
-import org.eclipse.uml2.uml.DeploymentTarget;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class DeploymentCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- protected final EObject source;
-
- /**
- * @generated
- */
- protected final EObject target;
-
- /**
- * @generated
- */
- protected DeploymentTarget container;
-
- /**
- * @generated
- */
- public DeploymentCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
- super(request.getLabel(), null, request);
- this.source = source;
- this.target = target;
- container = deduceContainer(source, target);
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- if (source == null && target == null) {
- return false;
- }
- if (source != null && false == source instanceof NamedElement) {
- return false;
- }
- if (target != null && false == target instanceof NamedElement) {
- 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().canCreateDeployment_4001(getContainer(), getSource(), getTarget());
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- if (!canExecute()) {
- throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
- }
-
- Deployment newElement = UMLFactory.eINSTANCE.createDeployment();
- getContainer().getDeployments()
- .add(newElement);
- newElement.getClients()
- .add(getSource());
- newElement.getSuppliers()
- .add(getTarget());
- ElementInitializers.getInstance().init_Deployment_4001(newElement);
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
-
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Deployment 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
- */
- @Override
- protected void setElementToEdit(EObject element) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @generated
- */
- protected NamedElement getSource() {
- return (NamedElement) source;
- }
-
- /**
- * @generated
- */
- protected NamedElement getTarget() {
- return (NamedElement) target;
- }
-
- /**
- * @generated
- */
- public DeploymentTarget getContainer() {
- return container;
- }
-
- /**
- * Default approach is to traverse ancestors of the source to find instance of container.
- * Modify with appropriate logic.
- *
- * @generated
- */
- protected DeploymentTarget 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 DeploymentTarget) {
- return (DeploymentTarget) element;
- }
- }
- return null;
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeploymentReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeploymentReorientCommand.java
deleted file mode 100644
index d47b7379fa5..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeploymentReorientCommand.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLBaseItemSemanticEditPolicy;
-import org.eclipse.uml2.uml.Deployment;
-import org.eclipse.uml2.uml.DeploymentTarget;
-import org.eclipse.uml2.uml.NamedElement;
-
-/**
- * @generated
- */
-public class DeploymentReorientCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private final int reorientDirection;
-
- /**
- * @generated
- */
- private final EObject oldEnd;
-
- /**
- * @generated
- */
- private final EObject newEnd;
-
- /**
- * @generated
- */
- public DeploymentReorientCommand(ReorientRelationshipRequest request) {
- super(request.getLabel(), request.getRelationship(), request);
- reorientDirection = request.getDirection();
- oldEnd = request.getOldRelationshipEnd();
- newEnd = request.getNewRelationshipEnd();
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- if (false == getElementToEdit() instanceof Deployment) {
- return false;
- }
- if (reorientDirection == ReorientRequest.REORIENT_SOURCE) {
- return canReorientSource();
- }
- if (reorientDirection == ReorientRequest.REORIENT_TARGET) {
- return canReorientTarget();
- }
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean canReorientSource() {
- if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
- return false;
- }
- if (getLink().getSuppliers()
- .size() != 1) {
- return false;
- }
- NamedElement target = getLink().getSuppliers()
- .get(0);
- if (!(getLink().eContainer() instanceof DeploymentTarget)) {
- return false;
- }
- DeploymentTarget container = (DeploymentTarget) getLink().eContainer();
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistDeployment_4001(container, getLink(), getNewSource(), target);
- }
-
- /**
- * @generated
- */
- protected boolean canReorientTarget() {
- if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
- return false;
- }
- if (getLink().getClients()
- .size() != 1) {
- return false;
- }
- NamedElement source = getLink().getClients()
- .get(0);
- if (!(getLink().eContainer() instanceof DeploymentTarget)) {
- return false;
- }
- DeploymentTarget container = (DeploymentTarget) getLink().eContainer();
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistDeployment_4001(container, getLink(), source, getNewTarget());
- }
-
- /**
- * @generated
- */
- @Override
- 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 == ReorientRequest.REORIENT_SOURCE) {
- return reorientSource();
- }
- if (reorientDirection == ReorientRequest.REORIENT_TARGET) {
- return reorientTarget();
- }
- throw new IllegalStateException();
- }
-
- /**
- * @generated
- */
- protected CommandResult reorientSource() throws ExecutionException {
- getLink().getClients()
- .remove(getOldSource());
- getLink().getClients()
- .add(getNewSource());
- return CommandResult.newOKCommandResult(getLink());
- }
-
- /**
- * @generated
- */
- protected CommandResult reorientTarget() throws ExecutionException {
- getLink().getSuppliers()
- .remove(getOldTarget());
- getLink().getSuppliers()
- .add(getNewTarget());
- return CommandResult.newOKCommandResult(getLink());
- }
-
- /**
- * @generated
- */
- protected Deployment getLink() {
- return (Deployment) getElementToEdit();
- }
-
- /**
- * @generated
- */
- protected NamedElement getOldSource() {
- return (NamedElement) oldEnd;
- }
-
- /**
- * @generated
- */
- protected NamedElement getNewSource() {
- return (NamedElement) newEnd;
- }
-
- /**
- * @generated
- */
- protected NamedElement getOldTarget() {
- return (NamedElement) oldEnd;
- }
-
- /**
- * @generated
- */
- protected NamedElement getNewTarget() {
- return (NamedElement) newEnd;
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeviceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeviceCreateCommand.java
deleted file mode 100644
index bcc579a44b3..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeviceCreateCommand.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Device;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class DeviceCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public DeviceCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDevice());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Device newElement = UMLFactory.eINSTANCE.createDevice();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_Device_2003(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Device 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);
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeviceCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeviceCreateCommandCN.java
deleted file mode 100644
index dbe712dcfa6..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeviceCreateCommandCN.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Device;
-import org.eclipse.uml2.uml.Node;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class DeviceCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public DeviceCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDevice());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Device newElement = UMLFactory.eINSTANCE.createDevice();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Node qualifiedTarget = (Node) target;
- qualifiedTarget.getNestedNodes()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_Device_16(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Device 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);
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ExecutionEnvironmentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ExecutionEnvironmentCreateCommand.java
deleted file mode 100644
index 5280e6d1e5b..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ExecutionEnvironmentCreateCommand.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.uml2.uml.ExecutionEnvironment;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ExecutionEnvironmentCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public ExecutionEnvironmentCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getExecutionEnvironment());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- ExecutionEnvironment newElement = UMLFactory.eINSTANCE.createExecutionEnvironment();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_ExecutionEnvironment_2002(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(ExecutionEnvironment 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);
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ExecutionEnvironmentCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ExecutionEnvironmentCreateCommandCN.java
deleted file mode 100644
index 03ba84dff58..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ExecutionEnvironmentCreateCommandCN.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.uml2.uml.ExecutionEnvironment;
-import org.eclipse.uml2.uml.Node;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ExecutionEnvironmentCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public ExecutionEnvironmentCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getExecutionEnvironment());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- ExecutionEnvironment newElement = UMLFactory.eINSTANCE.createExecutionEnvironment();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Node qualifiedTarget = (Node) target;
- qualifiedTarget.getNestedNodes()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_ExecutionEnvironment_21(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(ExecutionEnvironment 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);
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/GeneralizationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/GeneralizationCreateCommand.java
deleted file mode 100644
index 6ecafe49515..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/GeneralizationCreateCommand.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.papyrus.uml.diagram.deployment.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
- */
- protected Classifier container;
-
- /**
- * @generated
- */
- public GeneralizationCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
- super(request.getLabel(), null, request);
- this.source = source;
- this.target = target;
- container = deduceContainer(source, target);
- }
-
- /**
- * @generated
- */
- @Override
- 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
- if (getContainer() == null) {
- return false;
- }
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canCreateGeneralization_4003(getContainer(), getSource(), getTarget());
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- getContainer().getGeneralizations()
- .add(newElement);
- newElement.setSpecific(
- getSource()
- );
- newElement.setGeneral(
- getTarget()
- );
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
-
- }
-
- /**
- * @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
- */
- @Override
- protected void setElementToEdit(EObject element) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @generated
- */
- protected Classifier getSource() {
- return (Classifier) source;
- }
-
- /**
- * @generated
- */
- protected Classifier getTarget() {
- return (Classifier) target;
- }
-
- /**
- * @generated
- */
- public Classifier getContainer() {
- return container;
- }
-
- /**
- * Default approach is to traverse ancestors of the source to find instance of container.
- * Modify with appropriate logic.
- *
- * @generated
- */
- protected Classifier 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 Classifier) {
- return (Classifier) element;
- }
- }
- return null;
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/GeneralizationReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/GeneralizationReorientCommand.java
deleted file mode 100644
index 94060861f70..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/GeneralizationReorientCommand.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
-import org.eclipse.papyrus.uml.diagram.deployment.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
- */
- @Override
- public boolean canExecute() {
- if (false == getElementToEdit() instanceof Generalization) {
- return false;
- }
- if (reorientDirection == ReorientRequest.REORIENT_SOURCE) {
- return canReorientSource();
- }
- if (reorientDirection == ReorientRequest.REORIENT_TARGET) {
- return canReorientTarget();
- }
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean canReorientSource() {
- if (!(oldEnd instanceof Classifier && newEnd instanceof Classifier)) {
- return false;
- }
- Classifier target = getLink().getGeneral();
- if (!(getLink().eContainer() instanceof Classifier)) {
- return false;
- }
- Classifier container = (Classifier) getLink().eContainer();
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistGeneralization_4003(container, getLink(), getNewSource(), target);
- }
-
- /**
- * @generated
- */
- protected boolean canReorientTarget() {
- if (!(oldEnd instanceof Classifier && newEnd instanceof Classifier)) {
- return false;
- }
- Classifier source = getLink().getSpecific();
- if (!(getLink().eContainer() instanceof Classifier)) {
- return false;
- }
- Classifier container = (Classifier) getLink().eContainer();
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistGeneralization_4003(container, getLink(), source, getNewTarget());
- }
-
- /**
- * @generated
- */
- @Override
- 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 == ReorientRequest.REORIENT_SOURCE) {
- return reorientSource();
- }
- if (reorientDirection == ReorientRequest.REORIENT_TARGET) {
- return reorientTarget();
- }
- throw new IllegalStateException();
- }
-
- /**
- * @generated
- */
- protected CommandResult reorientSource() throws ExecutionException {
- getLink().setSpecific(
- getNewSource()
- );
- return CommandResult.newOKCommandResult(getLink());
- }
-
- /**
- * @generated
- */
- protected CommandResult reorientTarget() throws ExecutionException {
- getLink().setGeneral(
- getNewTarget()
- );
- return CommandResult.newOKCommandResult(getLink());
- }
-
- /**
- * @generated
- */
- protected Generalization getLink() {
- return (Generalization) getElementToEdit();
- }
-
- /**
- * @generated
- */
- protected Classifier getOldSource() {
- return (Classifier) oldEnd;
- }
-
- /**
- * @generated
- */
- protected Classifier getNewSource() {
- return (Classifier) newEnd;
- }
-
- /**
- * @generated
- */
- protected Classifier getOldTarget() {
- return (Classifier) oldEnd;
- }
-
- /**
- * @generated
- */
- protected Classifier getNewTarget() {
- return (Classifier) newEnd;
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ManifestationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ManifestationCreateCommand.java
deleted file mode 100644
index b0ea85be7c9..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ManifestationCreateCommand.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLBaseItemSemanticEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Artifact;
-import org.eclipse.uml2.uml.Manifestation;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * @generated
- */
-public class ManifestationCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- protected final EObject source;
-
- /**
- * @generated
- */
- protected final EObject target;
-
- /**
- * @generated
- */
- protected Artifact container;
-
- /**
- * @generated
- */
- public ManifestationCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
- super(request.getLabel(), null, request);
- this.source = source;
- this.target = target;
- container = deduceContainer(source, target);
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- if (source == null && target == null) {
- return false;
- }
- if (source != null && false == source instanceof NamedElement) {
- return false;
- }
- if (target != null && false == target instanceof NamedElement) {
- 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().canCreateManifestation_4002(getContainer(), getSource(), getTarget());
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- if (!canExecute()) {
- throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
- }
-
- Manifestation newElement = UMLFactory.eINSTANCE.createManifestation();
- getContainer().getManifestations()
- .add(newElement);
- newElement.getClients()
- .add(getSource());
- newElement.getSuppliers()
- .add(getTarget());
- ElementInitializers.getInstance().init_Manifestation_4002(newElement);
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
-
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Manifestation 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
- */
- @Override
- protected void setElementToEdit(EObject element) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @generated
- */
- protected NamedElement getSource() {
- return (NamedElement) source;
- }
-
- /**
- * @generated
- */
- protected NamedElement getTarget() {
- return (NamedElement) target;
- }
-
- /**
- * @generated
- */
- public Artifact getContainer() {
- return container;
- }
-
- /**
- * Default approach is to traverse ancestors of the source to find instance of container.
- * Modify with appropriate logic.
- *
- * @generated
- */
- protected Artifact 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 Artifact) {
- return (Artifact) element;
- }
- }
- return null;
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ManifestationReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ManifestationReorientCommand.java
deleted file mode 100644
index 647b5bc4be4..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ManifestationReorientCommand.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLBaseItemSemanticEditPolicy;
-import org.eclipse.uml2.uml.Artifact;
-import org.eclipse.uml2.uml.Manifestation;
-import org.eclipse.uml2.uml.NamedElement;
-
-/**
- * @generated
- */
-public class ManifestationReorientCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private final int reorientDirection;
-
- /**
- * @generated
- */
- private final EObject oldEnd;
-
- /**
- * @generated
- */
- private final EObject newEnd;
-
- /**
- * @generated
- */
- public ManifestationReorientCommand(ReorientRelationshipRequest request) {
- super(request.getLabel(), request.getRelationship(), request);
- reorientDirection = request.getDirection();
- oldEnd = request.getOldRelationshipEnd();
- newEnd = request.getNewRelationshipEnd();
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- if (false == getElementToEdit() instanceof Manifestation) {
- return false;
- }
- if (reorientDirection == ReorientRequest.REORIENT_SOURCE) {
- return canReorientSource();
- }
- if (reorientDirection == ReorientRequest.REORIENT_TARGET) {
- return canReorientTarget();
- }
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean canReorientSource() {
- if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
- return false;
- }
- if (getLink().getSuppliers()
- .size() != 1) {
- return false;
- }
- NamedElement target = getLink().getSuppliers()
- .get(0);
- if (!(getLink().eContainer() instanceof Artifact)) {
- return false;
- }
- Artifact container = (Artifact) getLink().eContainer();
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistManifestation_4002(container, getLink(), getNewSource(), target);
- }
-
- /**
- * @generated
- */
- protected boolean canReorientTarget() {
- if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
- return false;
- }
- if (getLink().getClients()
- .size() != 1) {
- return false;
- }
- NamedElement source = getLink().getClients()
- .get(0);
- if (!(getLink().eContainer() instanceof Artifact)) {
- return false;
- }
- Artifact container = (Artifact) getLink().eContainer();
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistManifestation_4002(container, getLink(), source, getNewTarget());
- }
-
- /**
- * @generated
- */
- @Override
- 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 == ReorientRequest.REORIENT_SOURCE) {
- return reorientSource();
- }
- if (reorientDirection == ReorientRequest.REORIENT_TARGET) {
- return reorientTarget();
- }
- throw new IllegalStateException();
- }
-
- /**
- * @generated
- */
- protected CommandResult reorientSource() throws ExecutionException {
- getLink().getClients()
- .remove(getOldSource());
- getLink().getClients()
- .add(getNewSource());
- return CommandResult.newOKCommandResult(getLink());
- }
-
- /**
- * @generated
- */
- protected CommandResult reorientTarget() throws ExecutionException {
- getLink().getSuppliers()
- .remove(getOldTarget());
- getLink().getSuppliers()
- .add(getNewTarget());
- return CommandResult.newOKCommandResult(getLink());
- }
-
- /**
- * @generated
- */
- protected Manifestation getLink() {
- return (Manifestation) getElementToEdit();
- }
-
- /**
- * @generated
- */
- protected NamedElement getOldSource() {
- return (NamedElement) oldEnd;
- }
-
- /**
- * @generated
- */
- protected NamedElement getNewSource() {
- return (NamedElement) newEnd;
- }
-
- /**
- * @generated
- */
- protected NamedElement getOldTarget() {
- return (NamedElement) oldEnd;
- }
-
- /**
- * @generated
- */
- protected NamedElement getNewTarget() {
- return (NamedElement) newEnd;
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ModelCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ModelCreateCommand.java
deleted file mode 100644
index 49d6b910ebc..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ModelCreateCommand.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Model;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ModelCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public ModelCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getModel());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Model newElement = UMLFactory.eINSTANCE.createModel();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_Model_2010(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Model 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);
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ModelCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ModelCreateCommandCN.java
deleted file mode 100644
index 1d21882522c..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ModelCreateCommandCN.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Model;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ModelCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public ModelCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getModel());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Model newElement = UMLFactory.eINSTANCE.createModel();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_Model_49(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Model 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);
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedArtifactNodeCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedArtifactNodeCreateCommandCN.java
deleted file mode 100644
index eccd8363066..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedArtifactNodeCreateCommandCN.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Artifact;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class NestedArtifactNodeCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public NestedArtifactNodeCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getArtifact());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Artifact newElement = UMLFactory.eINSTANCE.createArtifact();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_Artifact_40(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Artifact 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);
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedDeviceCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedDeviceCreateCommandCN.java
deleted file mode 100644
index 892dec48f28..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedDeviceCreateCommandCN.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Device;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class NestedDeviceCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public NestedDeviceCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDevice());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Device newElement = UMLFactory.eINSTANCE.createDevice();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_Device_44(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Device 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);
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedExecutionEnvironmentCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedExecutionEnvironmentCreateCommandCN.java
deleted file mode 100644
index 054e9ba971c..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedExecutionEnvironmentCreateCommandCN.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.uml2.uml.ExecutionEnvironment;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class NestedExecutionEnvironmentCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public NestedExecutionEnvironmentCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getExecutionEnvironment());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- ExecutionEnvironment newElement = UMLFactory.eINSTANCE.createExecutionEnvironment();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_ExecutionEnvironment_46(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(ExecutionEnvironment 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);
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedNodeCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedNodeCreateCommandCN.java
deleted file mode 100644
index 8d7eb1935c0..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedNodeCreateCommandCN.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Node;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class NestedNodeCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public NestedNodeCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getNode());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Node newElement = UMLFactory.eINSTANCE.createNode();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_Node_42(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Node 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);
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NodeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NodeCreateCommand.java
deleted file mode 100644
index eb9cc5ecef9..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NodeCreateCommand.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Node;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class NodeCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public NodeCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getNode());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Node newElement = UMLFactory.eINSTANCE.createNode();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_Node_2008(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Node 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);
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NodeCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NodeCreateCommandCN.java
deleted file mode 100644
index dd4fb105669..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NodeCreateCommandCN.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Node;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class NodeCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public NodeCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getNode());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Node newElement = UMLFactory.eINSTANCE.createNode();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Node qualifiedTarget = (Node) target;
- qualifiedTarget.getNestedNodes()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_Node_23(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Node 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);
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/PackageCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/PackageCreateCommand.java
deleted file mode 100644
index 9128a15766a..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/PackageCreateCommand.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class PackageCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public PackageCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPackage());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Package newElement = UMLFactory.eINSTANCE.createPackage();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_Package_2009(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Package 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);
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/PackageCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/PackageCreateCommandCN.java
deleted file mode 100644
index 5c0931f0f6f..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/PackageCreateCommandCN.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class PackageCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public PackageCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPackage());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Package newElement = UMLFactory.eINSTANCE.createPackage();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_Package_36(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Package 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);
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/ArtifactEditHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/ArtifactEditHelper.java
deleted file mode 100644
index 0e4a34fc9c6..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/ArtifactEditHelper.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.helpers;
-
-import org.eclipse.papyrus.uml.diagram.common.helper.UMLBaseEditHelper;
-
-/**
- * @generated
- */
-public class ArtifactEditHelper extends UMLBaseEditHelper {
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/CommentEditHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/CommentEditHelper.java
deleted file mode 100644
index b1e372f239c..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/CommentEditHelper.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.helpers;
-
-import org.eclipse.papyrus.uml.diagram.common.helper.UMLBaseEditHelper;
-
-/**
- * @generated
- */
-public class CommentEditHelper extends UMLBaseEditHelper {
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/ConstraintEditHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/ConstraintEditHelper.java
deleted file mode 100644
index 00389033726..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/ConstraintEditHelper.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.helpers;
-
-import org.eclipse.papyrus.uml.diagram.common.helper.UMLBaseEditHelper;
-
-/**
- * @generated
- */
-public class ConstraintEditHelper extends UMLBaseEditHelper {
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/DefaultNamedElementEditHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/DefaultNamedElementEditHelper.java
deleted file mode 100644
index b643fc292ce..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/DefaultNamedElementEditHelper.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.helpers;
-
-import org.eclipse.papyrus.uml.diagram.common.helper.UMLBaseEditHelper;
-
-/**
- * @generated
- */
-public class DefaultNamedElementEditHelper extends UMLBaseEditHelper {
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/DependencyEditHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/DependencyEditHelper.java
deleted file mode 100644
index 94e4cf361b1..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/DependencyEditHelper.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.helpers;
-
-import org.eclipse.papyrus.uml.diagram.common.helper.UMLBaseEditHelper;
-
-/**
- * @generated
- */
-public class DependencyEditHelper extends UMLBaseEditHelper {
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/DeploymentEditHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/DeploymentEditHelper.java
deleted file mode 100644
index 51ac6d618a0..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/DeploymentEditHelper.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.helpers;
-
-import org.eclipse.papyrus.uml.diagram.common.helper.UMLBaseEditHelper;
-
-/**
- * @generated
- */
-public class DeploymentEditHelper extends UMLBaseEditHelper {
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/DeviceEditHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/DeviceEditHelper.java
deleted file mode 100644
index 7640307473d..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/DeviceEditHelper.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.helpers;
-
-import org.eclipse.papyrus.uml.diagram.common.helper.UMLBaseEditHelper;
-
-/**
- * @generated
- */
-public class DeviceEditHelper extends UMLBaseEditHelper {
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/ExecutionEnvironmentEditHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/ExecutionEnvironmentEditHelper.java
deleted file mode 100644
index 914be46e395..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/ExecutionEnvironmentEditHelper.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.helpers;
-
-import org.eclipse.papyrus.uml.diagram.common.helper.UMLBaseEditHelper;
-
-/**
- * @generated
- */
-public class ExecutionEnvironmentEditHelper extends UMLBaseEditHelper {
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/GeneralizationEditHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/GeneralizationEditHelper.java
deleted file mode 100644
index 5e629d13792..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/GeneralizationEditHelper.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.helpers;
-
-import org.eclipse.papyrus.uml.diagram.common.helper.UMLBaseEditHelper;
-
-/**
- * @generated
- */
-public class GeneralizationEditHelper extends UMLBaseEditHelper {
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/ManifestationEditHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/ManifestationEditHelper.java
deleted file mode 100644
index 4da22dd5b83..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/ManifestationEditHelper.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.helpers;
-
-import org.eclipse.papyrus.uml.diagram.common.helper.UMLBaseEditHelper;
-
-/**
- * @generated
- */
-public class ManifestationEditHelper extends UMLBaseEditHelper {
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/ModelEditHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/ModelEditHelper.java
deleted file mode 100644
index 7e187f06885..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/ModelEditHelper.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.helpers;
-
-import org.eclipse.papyrus.uml.diagram.common.helper.UMLBaseEditHelper;
-
-/**
- * @generated
- */
-public class ModelEditHelper extends UMLBaseEditHelper {
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/NodeEditHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/NodeEditHelper.java
deleted file mode 100644
index 5c0cc60677a..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/NodeEditHelper.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.helpers;
-
-import org.eclipse.papyrus.uml.diagram.common.helper.UMLBaseEditHelper;
-
-/**
- * @generated
- */
-public class NodeEditHelper extends UMLBaseEditHelper {
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/UMLBaseEditHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/UMLBaseEditHelper.java
index b535d15c686..22763a0b329 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/UMLBaseEditHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/helpers/UMLBaseEditHelper.java
@@ -1,20 +1,20 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.helpers;
-
-import org.eclipse.gmf.tooling.runtime.edit.helpers.GeneratedEditHelperBase;
-
-/**
- * @generated
- */
-public class UMLBaseEditHelper extends GeneratedEditHelperBase {
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.helpers;
+
+import org.eclipse.gmf.tooling.runtime.edit.helpers.GeneratedEditHelperBase;
+
+/**
+ * @generated
+ */
+public class UMLBaseEditHelper extends GeneratedEditHelperBase {
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPart.java
index b7c9bc161ba..5598d1b834e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPart.java
@@ -27,11 +27,11 @@ 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.infra.gmfdiag.common.editpolicies.BorderDisplayEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ArtifactCompositeCompartmentItemSemanticEditPolicy;
import org.eclipse.papyrus.uml.diagram.deployment.part.Messages;
/**
@@ -66,12 +66,12 @@ public class ArtifactCompositeCompartmentEditPart extends ShapeCompartmentEditPa
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ArtifactCompositeCompartmentItemSemanticEditPolicy());
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ArtifactCompositeCompartmentCanonicalEditPolicy());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ArtifactCompositeCompartmentCanonicalEditPolicy());
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPartACN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPartACN.java
index ee70c6b5ec6..ad2de1f67e8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPartACN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPartACN.java
@@ -27,11 +27,11 @@ 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.infra.gmfdiag.common.editpolicies.BorderDisplayEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ArtifactCompositeCompartmentItemSemanticEditPolicyACN;
import org.eclipse.papyrus.uml.diagram.deployment.part.Messages;
/**
@@ -66,12 +66,12 @@ public class ArtifactCompositeCompartmentEditPartACN extends ShapeCompartmentEdi
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ArtifactCompositeCompartmentItemSemanticEditPolicyACN());
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ArtifactCompositeCompartmentCanonicalEditPolicyACN());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ArtifactCompositeCompartmentCanonicalEditPolicyACN());
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPartCN.java
index 0b2123bb868..4789ae8ca77 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactCompositeCompartmentEditPartCN.java
@@ -27,11 +27,11 @@ 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.infra.gmfdiag.common.editpolicies.BorderDisplayEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ArtifactCompositeCompartmentItemSemanticEditPolicyCN;
import org.eclipse.papyrus.uml.diagram.deployment.part.Messages;
/**
@@ -66,12 +66,12 @@ public class ArtifactCompositeCompartmentEditPartCN extends ShapeCompartmentEdit
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ArtifactCompositeCompartmentItemSemanticEditPolicyCN());
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ArtifactCompositeCompartmentCanonicalEditPolicyCN());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ArtifactCompositeCompartmentCanonicalEditPolicyCN());
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPart.java
index 0de48f91b3e..f54a6a8dbbb 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPart.java
@@ -1,362 +1,364 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.common.notify.Notification;
-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.ConstrainedToolbarLayout;
-import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.BasicCompartment;
-import org.eclipse.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.GetChildLayoutEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
-import org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.locator.RoundedRectangleLabelPositionLocator;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ArtifactFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ArtifactItemSemanticEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class ArtifactEditPart extends RoundedCompartmentEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 2006;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public ArtifactEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ArtifactItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
- installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
- installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, new GetChildLayoutEditPolicy());
- // 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() {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View) child.getModel();
- switch (UMLVisualIDRegistry.getVisualID(childView)) {
- case ArtifactFloatingLabelEditPart.VISUAL_ID:
- return new BorderItemSelectionEditPolicy() {
-
- @Override
- 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;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- @Override
- protected void handleNotificationEvent(Notification event) {
- /*
- * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart
- * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)!
- */
- if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
- Object notifier = event.getNotifier();
- List<?> modelChildren = ((View) getModel()).getChildren();
- if (false == notifier instanceof Edge
- && false == notifier instanceof BasicCompartment) {
- if (modelChildren.contains(event.getNotifier())) {
- return;
- }
- }
- }
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createNodeShape() {
- return primaryShape = new ArtifactFigure();
- }
-
- /**
- * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ArtifactFigure
- *
- * @generated
- */
- @Override
- public ArtifactFigure getPrimaryShape() {
- return (ArtifactFigure) primaryShape;
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof ArtifactNameEditPart) {
- ((ArtifactNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
- return true;
- }
-
-
- if (childEditPart instanceof ArtifactCompositeCompartmentEditPart) {
- IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
- setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
- pane.add(((ArtifactCompositeCompartmentEditPart) childEditPart).getFigure());
- return true;
- }
-
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof ArtifactNameEditPart) {
- return true;
- }
- if (childEditPart instanceof ArtifactCompositeCompartmentEditPart) {
- IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
- pane.remove(((ArtifactCompositeCompartmentEditPart) childEditPart).getFigure());
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- if (editPart instanceof ArtifactCompositeCompartmentEditPart) {
- return getPrimaryShape().getCompositeCompartmentFigure();
- }
- if (editPart instanceof IBorderItemEditPart) {
- return getBorderedFigure().getBorderItemContainer();
- }
- return getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
- if (borderItemEditPart instanceof ArtifactFloatingLabelEditPart) {
- IBorderItemLocator locator = new RoundedRectangleLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else
- {
- super.addBorderItem(borderItemContainer, borderItemEditPart);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected NodeFigure createNodePlate() {
- RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 70);
- return result;
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected NodeFigure createMainFigure() {
- return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
-
- }
-
- /**
- * Default implementation treats passed figure as content pane.
- * Respects layout one may have set for generated figure.
- *
- * @param nodeShape
- * instance of generated figure class
- * @generated
- */
- @Override
- protected IFigure setupContentPane(IFigure nodeShape) {
- if (nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- @Override
- public IFigure getContentPane() {
- if (contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineWidth(int width) {
- super.setLineWidth(width);
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineType(int style) {
- if (primaryShape instanceof IPapyrusNodeFigure) {
- ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- @Override
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(ArtifactNameEditPart.VISUAL_ID));
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+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.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.BasicCompartment;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.GetChildLayoutEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.locator.RoundedRectangleLabelPositionLocator;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ArtifactFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class ArtifactEditPart extends RoundedCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2006;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public ArtifactEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
+ installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
+ installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, new GetChildLayoutEditPolicy());
+ // 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() {
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ View childView = (View) child.getModel();
+ switch (UMLVisualIDRegistry.getVisualID(childView)) {
+ case ArtifactFloatingLabelEditPart.VISUAL_ID:
+ return new BorderItemSelectionEditPolicy() {
+
+ @Override
+ 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;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ /*
+ * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart
+ * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)!
+ */
+ if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
+ Object notifier = event.getNotifier();
+ List<?> modelChildren = ((View) getModel()).getChildren();
+ if (false == notifier instanceof Edge
+ && false == notifier instanceof BasicCompartment) {
+ if (modelChildren.contains(event.getNotifier())) {
+ return;
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return primaryShape = new ArtifactFigure();
+ }
+
+ /**
+ * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ArtifactFigure
+ *
+ * @generated
+ */
+ @Override
+ public ArtifactFigure getPrimaryShape() {
+ return (ArtifactFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ArtifactNameEditPart) {
+ ((ArtifactNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+
+
+ if (childEditPart instanceof ArtifactCompositeCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((ArtifactCompositeCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ArtifactNameEditPart) {
+ return true;
+ }
+ if (childEditPart instanceof ArtifactCompositeCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
+ pane.remove(((ArtifactCompositeCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ if (editPart instanceof ArtifactCompositeCompartmentEditPart) {
+ return getPrimaryShape().getCompositeCompartmentFigure();
+ }
+ if (editPart instanceof IBorderItemEditPart) {
+ return getBorderedFigure().getBorderItemContainer();
+ }
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
+ if (borderItemEditPart instanceof ArtifactFloatingLabelEditPart) {
+ IBorderItemLocator locator = new RoundedRectangleLabelPositionLocator(getMainFigure());
+ borderItemContainer.add(borderItemEditPart.getFigure(), locator);
+ } else {
+ super.addBorderItem(borderItemContainer, borderItemEditPart);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodePlate() {
+ RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 70);
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createMainFigure() {
+ return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane.
+ * Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ @Override
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ super.setLineWidth(width);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(int style) {
+ if (primaryShape instanceof IPapyrusNodeFigure) {
+ ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(ArtifactNameEditPart.VISUAL_ID));
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPartACN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPartACN.java
index f996a4f013f..e11b82facff 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPartACN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPartACN.java
@@ -1,362 +1,364 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.common.notify.Notification;
-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.ConstrainedToolbarLayout;
-import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.BasicCompartment;
-import org.eclipse.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.GetChildLayoutEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
-import org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.locator.RoundedRectangleLabelPositionLocator;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ArtifactFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ArtifactItemSemanticEditPolicyACN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class ArtifactEditPartACN extends RoundedCompartmentEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 28;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public ArtifactEditPartACN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ArtifactItemSemanticEditPolicyACN());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
- installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
- installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, new GetChildLayoutEditPolicy());
- // 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() {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View) child.getModel();
- switch (UMLVisualIDRegistry.getVisualID(childView)) {
- case ArtifactFloatingLabelEditPartACN.VISUAL_ID:
- return new BorderItemSelectionEditPolicy() {
-
- @Override
- 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;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- @Override
- protected void handleNotificationEvent(Notification event) {
- /*
- * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart
- * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)!
- */
- if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
- Object notifier = event.getNotifier();
- List<?> modelChildren = ((View) getModel()).getChildren();
- if (false == notifier instanceof Edge
- && false == notifier instanceof BasicCompartment) {
- if (modelChildren.contains(event.getNotifier())) {
- return;
- }
- }
- }
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createNodeShape() {
- return primaryShape = new ArtifactFigure();
- }
-
- /**
- * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ArtifactFigure
- *
- * @generated
- */
- @Override
- public ArtifactFigure getPrimaryShape() {
- return (ArtifactFigure) primaryShape;
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof ArtifactNameEditPartACN) {
- ((ArtifactNameEditPartACN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
- return true;
- }
-
-
- if (childEditPart instanceof ArtifactCompositeCompartmentEditPartACN) {
- IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
- setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
- pane.add(((ArtifactCompositeCompartmentEditPartACN) childEditPart).getFigure());
- return true;
- }
-
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof ArtifactNameEditPartACN) {
- return true;
- }
- if (childEditPart instanceof ArtifactCompositeCompartmentEditPartACN) {
- IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
- pane.remove(((ArtifactCompositeCompartmentEditPartACN) childEditPart).getFigure());
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- if (editPart instanceof ArtifactCompositeCompartmentEditPartACN) {
- return getPrimaryShape().getCompositeCompartmentFigure();
- }
- if (editPart instanceof IBorderItemEditPart) {
- return getBorderedFigure().getBorderItemContainer();
- }
- return getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
- if (borderItemEditPart instanceof ArtifactFloatingLabelEditPartACN) {
- IBorderItemLocator locator = new RoundedRectangleLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else
- {
- super.addBorderItem(borderItemContainer, borderItemEditPart);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected NodeFigure createNodePlate() {
- RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 70);
- return result;
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected NodeFigure createMainFigure() {
- return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
-
- }
-
- /**
- * Default implementation treats passed figure as content pane.
- * Respects layout one may have set for generated figure.
- *
- * @param nodeShape
- * instance of generated figure class
- * @generated
- */
- @Override
- protected IFigure setupContentPane(IFigure nodeShape) {
- if (nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- @Override
- public IFigure getContentPane() {
- if (contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineWidth(int width) {
- super.setLineWidth(width);
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineType(int style) {
- if (primaryShape instanceof IPapyrusNodeFigure) {
- ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- @Override
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(ArtifactNameEditPartACN.VISUAL_ID));
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+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.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.BasicCompartment;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.GetChildLayoutEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.locator.RoundedRectangleLabelPositionLocator;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ArtifactFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class ArtifactEditPartACN extends RoundedCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 28;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public ArtifactEditPartACN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
+ installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
+ installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, new GetChildLayoutEditPolicy());
+ // 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() {
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ View childView = (View) child.getModel();
+ switch (UMLVisualIDRegistry.getVisualID(childView)) {
+ case ArtifactFloatingLabelEditPartACN.VISUAL_ID:
+ return new BorderItemSelectionEditPolicy() {
+
+ @Override
+ 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;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ /*
+ * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart
+ * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)!
+ */
+ if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
+ Object notifier = event.getNotifier();
+ List<?> modelChildren = ((View) getModel()).getChildren();
+ if (false == notifier instanceof Edge
+ && false == notifier instanceof BasicCompartment) {
+ if (modelChildren.contains(event.getNotifier())) {
+ return;
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return primaryShape = new ArtifactFigure();
+ }
+
+ /**
+ * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ArtifactFigure
+ *
+ * @generated
+ */
+ @Override
+ public ArtifactFigure getPrimaryShape() {
+ return (ArtifactFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ArtifactNameEditPartACN) {
+ ((ArtifactNameEditPartACN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+
+
+ if (childEditPart instanceof ArtifactCompositeCompartmentEditPartACN) {
+ IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((ArtifactCompositeCompartmentEditPartACN) childEditPart).getFigure());
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ArtifactNameEditPartACN) {
+ return true;
+ }
+ if (childEditPart instanceof ArtifactCompositeCompartmentEditPartACN) {
+ IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
+ pane.remove(((ArtifactCompositeCompartmentEditPartACN) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ if (editPart instanceof ArtifactCompositeCompartmentEditPartACN) {
+ return getPrimaryShape().getCompositeCompartmentFigure();
+ }
+ if (editPart instanceof IBorderItemEditPart) {
+ return getBorderedFigure().getBorderItemContainer();
+ }
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
+ if (borderItemEditPart instanceof ArtifactFloatingLabelEditPartACN) {
+ IBorderItemLocator locator = new RoundedRectangleLabelPositionLocator(getMainFigure());
+ borderItemContainer.add(borderItemEditPart.getFigure(), locator);
+ } else {
+ super.addBorderItem(borderItemContainer, borderItemEditPart);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodePlate() {
+ RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 70);
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createMainFigure() {
+ return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane.
+ * Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ @Override
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ super.setLineWidth(width);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(int style) {
+ if (primaryShape instanceof IPapyrusNodeFigure) {
+ ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(ArtifactNameEditPartACN.VISUAL_ID));
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPartCN.java
index d4dd45c0c74..591e3aef9b8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactEditPartCN.java
@@ -1,362 +1,364 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.common.notify.Notification;
-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.ConstrainedToolbarLayout;
-import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.BasicCompartment;
-import org.eclipse.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.GetChildLayoutEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
-import org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.locator.RoundedRectangleLabelPositionLocator;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ArtifactFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ArtifactItemSemanticEditPolicyCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class ArtifactEditPartCN extends RoundedCompartmentEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 25;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public ArtifactEditPartCN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ArtifactItemSemanticEditPolicyCN());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
- installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
- installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, new GetChildLayoutEditPolicy());
- // 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() {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View) child.getModel();
- switch (UMLVisualIDRegistry.getVisualID(childView)) {
- case ArtifactFloatingLabelEditPartCN.VISUAL_ID:
- return new BorderItemSelectionEditPolicy() {
-
- @Override
- 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;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- @Override
- protected void handleNotificationEvent(Notification event) {
- /*
- * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart
- * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)!
- */
- if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
- Object notifier = event.getNotifier();
- List<?> modelChildren = ((View) getModel()).getChildren();
- if (false == notifier instanceof Edge
- && false == notifier instanceof BasicCompartment) {
- if (modelChildren.contains(event.getNotifier())) {
- return;
- }
- }
- }
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createNodeShape() {
- return primaryShape = new ArtifactFigure();
- }
-
- /**
- * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ArtifactFigure
- *
- * @generated
- */
- @Override
- public ArtifactFigure getPrimaryShape() {
- return (ArtifactFigure) primaryShape;
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof ArtifactNameEditPartCN) {
- ((ArtifactNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
- return true;
- }
-
-
- if (childEditPart instanceof ArtifactCompositeCompartmentEditPartCN) {
- IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
- setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
- pane.add(((ArtifactCompositeCompartmentEditPartCN) childEditPart).getFigure());
- return true;
- }
-
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof ArtifactNameEditPartCN) {
- return true;
- }
- if (childEditPart instanceof ArtifactCompositeCompartmentEditPartCN) {
- IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
- pane.remove(((ArtifactCompositeCompartmentEditPartCN) childEditPart).getFigure());
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- if (editPart instanceof ArtifactCompositeCompartmentEditPartCN) {
- return getPrimaryShape().getCompositeCompartmentFigure();
- }
- if (editPart instanceof IBorderItemEditPart) {
- return getBorderedFigure().getBorderItemContainer();
- }
- return getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
- if (borderItemEditPart instanceof ArtifactFloatingLabelEditPartCN) {
- IBorderItemLocator locator = new RoundedRectangleLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else
- {
- super.addBorderItem(borderItemContainer, borderItemEditPart);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected NodeFigure createNodePlate() {
- RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 70);
- return result;
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected NodeFigure createMainFigure() {
- return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
-
- }
-
- /**
- * Default implementation treats passed figure as content pane.
- * Respects layout one may have set for generated figure.
- *
- * @param nodeShape
- * instance of generated figure class
- * @generated
- */
- @Override
- protected IFigure setupContentPane(IFigure nodeShape) {
- if (nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- @Override
- public IFigure getContentPane() {
- if (contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineWidth(int width) {
- super.setLineWidth(width);
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineType(int style) {
- if (primaryShape instanceof IPapyrusNodeFigure) {
- ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- @Override
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(ArtifactNameEditPartCN.VISUAL_ID));
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+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.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.BasicCompartment;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.GetChildLayoutEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.locator.RoundedRectangleLabelPositionLocator;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ArtifactFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class ArtifactEditPartCN extends RoundedCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 25;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public ArtifactEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
+ installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
+ installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, new GetChildLayoutEditPolicy());
+ // 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() {
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ View childView = (View) child.getModel();
+ switch (UMLVisualIDRegistry.getVisualID(childView)) {
+ case ArtifactFloatingLabelEditPartCN.VISUAL_ID:
+ return new BorderItemSelectionEditPolicy() {
+
+ @Override
+ 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;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ /*
+ * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart
+ * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)!
+ */
+ if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
+ Object notifier = event.getNotifier();
+ List<?> modelChildren = ((View) getModel()).getChildren();
+ if (false == notifier instanceof Edge
+ && false == notifier instanceof BasicCompartment) {
+ if (modelChildren.contains(event.getNotifier())) {
+ return;
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return primaryShape = new ArtifactFigure();
+ }
+
+ /**
+ * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ArtifactFigure
+ *
+ * @generated
+ */
+ @Override
+ public ArtifactFigure getPrimaryShape() {
+ return (ArtifactFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ArtifactNameEditPartCN) {
+ ((ArtifactNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+
+
+ if (childEditPart instanceof ArtifactCompositeCompartmentEditPartCN) {
+ IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((ArtifactCompositeCompartmentEditPartCN) childEditPart).getFigure());
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ArtifactNameEditPartCN) {
+ return true;
+ }
+ if (childEditPart instanceof ArtifactCompositeCompartmentEditPartCN) {
+ IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
+ pane.remove(((ArtifactCompositeCompartmentEditPartCN) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ if (editPart instanceof ArtifactCompositeCompartmentEditPartCN) {
+ return getPrimaryShape().getCompositeCompartmentFigure();
+ }
+ if (editPart instanceof IBorderItemEditPart) {
+ return getBorderedFigure().getBorderItemContainer();
+ }
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
+ if (borderItemEditPart instanceof ArtifactFloatingLabelEditPartCN) {
+ IBorderItemLocator locator = new RoundedRectangleLabelPositionLocator(getMainFigure());
+ borderItemContainer.add(borderItemEditPart.getFigure(), locator);
+ } else {
+ super.addBorderItem(borderItemContainer, borderItemEditPart);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodePlate() {
+ RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 70);
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createMainFigure() {
+ return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane.
+ * Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ @Override
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ super.setLineWidth(width);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(int style) {
+ if (primaryShape instanceof IPapyrusNodeFigure) {
+ ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(ArtifactNameEditPartCN.VISUAL_ID));
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPart.java
index a9a2d23a59b..a6c2c9f88c4 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPart.java
@@ -1,861 +1,845 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class ArtifactFloatingLabelEditPart extends
- FloatingLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart
-{
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 61;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
-
- /**
- * @generated
- */
- static {
- registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public ArtifactFloatingLabelEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- 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 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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Artifact_2006, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- 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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new PapyrusWrappingLabel();
- }
-
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class ArtifactFloatingLabelEditPart extends
+ FloatingLabelEditPart
+ implements ITextAwareEditPart, IBorderItemEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 61;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPart.VISUAL_ID), new Point(0, 0));
+ }
+
+ /**
+ * @generated
+ */
+ public ArtifactFloatingLabelEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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 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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Artifact_2006, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPart.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ 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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new PapyrusWrappingLabel();
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPartACN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPartACN.java
index 0aa455a6478..9456abeaae9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPartACN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPartACN.java
@@ -1,861 +1,845 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class ArtifactFloatingLabelEditPartACN extends
- FloatingLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart
-{
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 60;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
-
- /**
- * @generated
- */
- static {
- registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartACN.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public ArtifactFloatingLabelEditPartACN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- 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 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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Artifact_28, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartACN.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- 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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new PapyrusWrappingLabel();
- }
-
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class ArtifactFloatingLabelEditPartACN extends
+ FloatingLabelEditPart
+ implements ITextAwareEditPart, IBorderItemEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 60;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartACN.VISUAL_ID), new Point(0, 0));
+ }
+
+ /**
+ * @generated
+ */
+ public ArtifactFloatingLabelEditPartACN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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 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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Artifact_28, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartACN.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ 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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new PapyrusWrappingLabel();
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPartCN.java
index b7c58782dc0..2c7b1cbf08c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactFloatingLabelEditPartCN.java
@@ -1,861 +1,845 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class ArtifactFloatingLabelEditPartCN extends
- FloatingLabelEditPart
- implements ITextAwareEditPart, IBorderItemEditPart
-{
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 59;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
-
- /**
- * @generated
- */
- static {
- registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartCN.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public ArtifactFloatingLabelEditPartCN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- 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 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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Artifact_25, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartCN.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- 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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new PapyrusWrappingLabel();
- }
-
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class ArtifactFloatingLabelEditPartCN extends
+ FloatingLabelEditPart
+ implements ITextAwareEditPart, IBorderItemEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 59;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartCN.VISUAL_ID), new Point(0, 0));
+ }
+
+ /**
+ * @generated
+ */
+ public ArtifactFloatingLabelEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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 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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Artifact_25, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartCN.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ 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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new PapyrusWrappingLabel();
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPart.java
index e5a087fa56a..17562f55438 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPart.java
@@ -1,871 +1,856 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 8;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public ArtifactNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Artifact_2006, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class ArtifactNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 8;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public ArtifactNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Artifact_2006, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPart.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPartACN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPartACN.java
index 0f65de8b718..06b39990c69 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPartACN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPartACN.java
@@ -1,871 +1,856 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 29;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public ArtifactNameEditPartACN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Artifact_28, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPartACN.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class ArtifactNameEditPartACN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 29;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public ArtifactNameEditPartACN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Artifact_28, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPartACN.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPartCN.java
index df9ae85dd29..2429590c8f7 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ArtifactNameEditPartCN.java
@@ -1,871 +1,856 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 27;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public ArtifactNameEditPartCN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Artifact_25, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPartCN.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class ArtifactNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 27;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public ArtifactNameEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Artifact_25, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPartCN.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentAnnotatedElementEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentAnnotatedElementEditPart.java
index 9283d5b7e53..dcbf6cd9ec4 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentAnnotatedElementEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentAnnotatedElementEditPart.java
@@ -1,68 +1,68 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import org.eclipse.draw2d.Connection;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart;
-import org.eclipse.papyrus.uml.diagram.common.figure.edge.SimpleDashedEdgeFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.CommentAnnotatedElementItemSemanticEditPolicy;
-
-/**
- * @generated
- */
-public class CommentAnnotatedElementEditPart extends ConnectionEditPart implements ITreeBranchEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 4008;
-
- /**
- * @generated
- */
- public CommentAnnotatedElementEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CommentAnnotatedElementItemSemanticEditPolicy());
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected Connection createConnectionFigure() {
- return new SimpleDashedEdgeFigure();
- }
-
- /**
- * @generated
- */
- @Override
- public SimpleDashedEdgeFigure getPrimaryShape() {
- return (SimpleDashedEdgeFigure) getFigure();
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.figure.edge.SimpleDashedEdgeFigure;
+
+/**
+ * @generated
+ */
+public class CommentAnnotatedElementEditPart extends ConnectionEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4008;
+
+ /**
+ * @generated
+ */
+ public CommentAnnotatedElementEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected Connection createConnectionFigure() {
+ return new SimpleDashedEdgeFigure();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public SimpleDashedEdgeFigure getPrimaryShape() {
+ return (SimpleDashedEdgeFigure) getFigure();
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentBodyEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentBodyEditPart.java
index 4667e7cc856..e4170c582f5 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentBodyEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentBodyEditPart.java
@@ -1,871 +1,856 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 1;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public CommentBodyEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Comment_2001, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentBodyEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 1;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public CommentBodyEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Comment_2001, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentBodyEditPart.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentBodyEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentBodyEditPartCN.java
index b26f973878a..9cf69625276 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentBodyEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentBodyEditPartCN.java
@@ -1,871 +1,856 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 55;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public CommentBodyEditPartCN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Comment_54, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentBodyEditPartCN.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class CommentBodyEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 55;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public CommentBodyEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Comment_54, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentBodyEditPartCN.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentEditPart.java
index a7cc3ecebeb..90b74c7ad7a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentEditPart.java
@@ -1,282 +1,286 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.common.notify.Notification;
-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.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusReflowableShapeEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
-import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractCommentEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.HTMLCornerBentFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.CommentItemSemanticEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class CommentEditPart extends AbstractCommentEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 2001;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public CommentEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CommentItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusReflowableShapeEditPolicy());
- // 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() {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- @Override
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createNodeShape() {
- return primaryShape = new HTMLCornerBentFigure();
- }
-
- /**
- * org.eclipse.papyrus.uml.diagram.common.figure.node.HTMLCornerBentFigure
- *
- * @generated
- */
- @Override
- public HTMLCornerBentFigure getPrimaryShape() {
- return (HTMLCornerBentFigure) primaryShape;
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof CommentBodyEditPart) {
- ((CommentBodyEditPart) childEditPart).setLabel(getPrimaryShape().getCornerBentFigure());
- return true;
- }
-
-
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof CommentBodyEditPart) {
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- return getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected NodeFigure createNodePlate() {
- RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(40, 40);
- return result;
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected NodeFigure createNodeFigure() {
- return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
-
- }
-
- /**
- * Default implementation treats passed figure as content pane.
- * Respects layout one may have set for generated figure.
- *
- * @param nodeShape
- * instance of generated figure class
- * @generated
- */
- @Override
- protected IFigure setupContentPane(IFigure nodeShape) {
- if (nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- @Override
- public IFigure getContentPane() {
- if (contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineWidth(int width) {
- super.setLineWidth(width);
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineType(int style) {
- if (primaryShape instanceof IPapyrusNodeFigure) {
- ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- @Override
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(CommentBodyEditPart.VISUAL_ID));
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+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.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusReflowableShapeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractCommentEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.HTMLCornerBentFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class CommentEditPart extends AbstractCommentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2001;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public CommentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusReflowableShapeEditPolicy());
+ // 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() {
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return primaryShape = new HTMLCornerBentFigure();
+ }
+
+ /**
+ * org.eclipse.papyrus.uml.diagram.common.figure.node.HTMLCornerBentFigure
+ *
+ * @generated
+ */
+ @Override
+ public HTMLCornerBentFigure getPrimaryShape() {
+ return (HTMLCornerBentFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof CommentBodyEditPart) {
+ ((CommentBodyEditPart) childEditPart).setLabel(getPrimaryShape().getCornerBentFigure());
+ return true;
+ }
+
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof CommentBodyEditPart) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodePlate() {
+ RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(40, 40);
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodeFigure() {
+ return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane.
+ * Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ @Override
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ super.setLineWidth(width);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(int style) {
+ if (primaryShape instanceof IPapyrusNodeFigure) {
+ ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(CommentBodyEditPart.VISUAL_ID));
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentEditPartCN.java
index b376307938e..163eca5a5de 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/CommentEditPartCN.java
@@ -1,282 +1,286 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.common.notify.Notification;
-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.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusReflowableShapeEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
-import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractCommentEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.HTMLCornerBentFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.CommentItemSemanticEditPolicyCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class CommentEditPartCN extends AbstractCommentEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 54;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public CommentEditPartCN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CommentItemSemanticEditPolicyCN());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusReflowableShapeEditPolicy());
- // 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() {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- @Override
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createNodeShape() {
- return primaryShape = new HTMLCornerBentFigure();
- }
-
- /**
- * org.eclipse.papyrus.uml.diagram.common.figure.node.HTMLCornerBentFigure
- *
- * @generated
- */
- @Override
- public HTMLCornerBentFigure getPrimaryShape() {
- return (HTMLCornerBentFigure) primaryShape;
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof CommentBodyEditPartCN) {
- ((CommentBodyEditPartCN) childEditPart).setLabel(getPrimaryShape().getCornerBentFigure());
- return true;
- }
-
-
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof CommentBodyEditPartCN) {
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- return getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected NodeFigure createNodePlate() {
- RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(40, 40);
- return result;
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected NodeFigure createNodeFigure() {
- return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
-
- }
-
- /**
- * Default implementation treats passed figure as content pane.
- * Respects layout one may have set for generated figure.
- *
- * @param nodeShape
- * instance of generated figure class
- * @generated
- */
- @Override
- protected IFigure setupContentPane(IFigure nodeShape) {
- if (nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- @Override
- public IFigure getContentPane() {
- if (contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineWidth(int width) {
- super.setLineWidth(width);
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineType(int style) {
- if (primaryShape instanceof IPapyrusNodeFigure) {
- ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- @Override
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(CommentBodyEditPartCN.VISUAL_ID));
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+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.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusReflowableShapeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractCommentEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.HTMLCornerBentFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class CommentEditPartCN extends AbstractCommentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 54;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public CommentEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusReflowableShapeEditPolicy());
+ // 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() {
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return primaryShape = new HTMLCornerBentFigure();
+ }
+
+ /**
+ * org.eclipse.papyrus.uml.diagram.common.figure.node.HTMLCornerBentFigure
+ *
+ * @generated
+ */
+ @Override
+ public HTMLCornerBentFigure getPrimaryShape() {
+ return (HTMLCornerBentFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof CommentBodyEditPartCN) {
+ ((CommentBodyEditPartCN) childEditPart).setLabel(getPrimaryShape().getCornerBentFigure());
+ return true;
+ }
+
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof CommentBodyEditPartCN) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodePlate() {
+ RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(40, 40);
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodeFigure() {
+ return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane.
+ * Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ @Override
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ super.setLineWidth(width);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(int style) {
+ if (primaryShape instanceof IPapyrusNodeFigure) {
+ ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(CommentBodyEditPartCN.VISUAL_ID));
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintConstrainedElementEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintConstrainedElementEditPart.java
index 2b799664b32..edc321fe4f6 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintConstrainedElementEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintConstrainedElementEditPart.java
@@ -1,68 +1,68 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import org.eclipse.draw2d.Connection;
-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.uml.diagram.common.editparts.UMLConnectionNodeEditPart;
-import org.eclipse.papyrus.uml.diagram.common.figure.edge.SimpleDashedEdgeFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ConstraintConstrainedElementItemSemanticEditPolicy;
-
-/**
- * @generated
- */
-public class ConstraintConstrainedElementEditPart extends UMLConnectionNodeEditPart implements ITreeBranchEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 4009;
-
- /**
- * @generated
- */
- public ConstraintConstrainedElementEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ConstraintConstrainedElementItemSemanticEditPolicy());
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected Connection createConnectionFigure() {
- return new SimpleDashedEdgeFigure();
- }
-
- /**
- * @generated
- */
- @Override
- public SimpleDashedEdgeFigure getPrimaryShape() {
- return (SimpleDashedEdgeFigure) getFigure();
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editparts.UMLConnectionNodeEditPart;
+import org.eclipse.papyrus.uml.diagram.common.figure.edge.SimpleDashedEdgeFigure;
+
+/**
+ * @generated
+ */
+public class ConstraintConstrainedElementEditPart extends UMLConnectionNodeEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4009;
+
+ /**
+ * @generated
+ */
+ public ConstraintConstrainedElementEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected Connection createConnectionFigure() {
+ return new SimpleDashedEdgeFigure();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public SimpleDashedEdgeFigure getPrimaryShape() {
+ return (SimpleDashedEdgeFigure) getFigure();
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintEditPart.java
index eedbb2e7c74..193f0075d01 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintEditPart.java
@@ -1,287 +1,291 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.common.notify.Notification;
-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.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
-import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractConstraintEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ConstraintFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ConstraintItemSemanticEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class ConstraintEditPart extends AbstractConstraintEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 2005;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public ConstraintEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ConstraintItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
- // 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() {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- @Override
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createNodeShape() {
- return primaryShape = new ConstraintFigure();
- }
-
- /**
- * org.eclipse.papyrus.uml.diagram.common.figure.node.ConstraintFigure
- *
- * @generated
- */
- @Override
- public ConstraintFigure getPrimaryShape() {
- return (ConstraintFigure) primaryShape;
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof ConstraintNameEditPart) {
- ((ConstraintNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
- return true;
- }
- if (childEditPart instanceof ConstraintSpecificationEditPart) {
- ((ConstraintSpecificationEditPart) childEditPart).setLabel(getPrimaryShape().getConstraintFigure());
- return true;
- }
-
-
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof ConstraintNameEditPart) {
- return true;
- }
- if (childEditPart instanceof ConstraintSpecificationEditPart) {
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- return getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected NodeFigure createNodePlate() {
- RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(40, 40);
- return result;
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected NodeFigure createNodeFigure() {
- return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
-
- }
-
- /**
- * Default implementation treats passed figure as content pane.
- * Respects layout one may have set for generated figure.
- *
- * @param nodeShape
- * instance of generated figure class
- * @generated
- */
- @Override
- protected IFigure setupContentPane(IFigure nodeShape) {
- if (nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- @Override
- public IFigure getContentPane() {
- if (contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineWidth(int width) {
- super.setLineWidth(width);
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineType(int style) {
- if (primaryShape instanceof IPapyrusNodeFigure) {
- ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- @Override
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(ConstraintNameEditPart.VISUAL_ID));
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+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.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractConstraintEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ConstraintFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class ConstraintEditPart extends AbstractConstraintEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2005;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public ConstraintEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ // 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() {
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return primaryShape = new ConstraintFigure();
+ }
+
+ /**
+ * org.eclipse.papyrus.uml.diagram.common.figure.node.ConstraintFigure
+ *
+ * @generated
+ */
+ @Override
+ public ConstraintFigure getPrimaryShape() {
+ return (ConstraintFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ConstraintNameEditPart) {
+ ((ConstraintNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof ConstraintSpecificationEditPart) {
+ ((ConstraintSpecificationEditPart) childEditPart).setLabel(getPrimaryShape().getConstraintFigure());
+ return true;
+ }
+
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ConstraintNameEditPart) {
+ return true;
+ }
+ if (childEditPart instanceof ConstraintSpecificationEditPart) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodePlate() {
+ RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(40, 40);
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodeFigure() {
+ return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane.
+ * Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ @Override
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ super.setLineWidth(width);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(int style) {
+ if (primaryShape instanceof IPapyrusNodeFigure) {
+ ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(ConstraintNameEditPart.VISUAL_ID));
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintEditPartCN.java
index d5ec2ba7507..a16daa8545f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintEditPartCN.java
@@ -1,287 +1,291 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.common.notify.Notification;
-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.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
-import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractConstraintEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ConstraintFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ConstraintItemSemanticEditPolicyCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class ConstraintEditPartCN extends AbstractConstraintEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 56;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public ConstraintEditPartCN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ConstraintItemSemanticEditPolicyCN());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
- // 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() {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- @Override
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createNodeShape() {
- return primaryShape = new ConstraintFigure();
- }
-
- /**
- * org.eclipse.papyrus.uml.diagram.common.figure.node.ConstraintFigure
- *
- * @generated
- */
- @Override
- public ConstraintFigure getPrimaryShape() {
- return (ConstraintFigure) primaryShape;
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof ConstraintNameEditPartCN) {
- ((ConstraintNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
- return true;
- }
- if (childEditPart instanceof ConstraintSpecificationEditPartCN) {
- ((ConstraintSpecificationEditPartCN) childEditPart).setLabel(getPrimaryShape().getConstraintFigure());
- return true;
- }
-
-
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof ConstraintNameEditPartCN) {
- return true;
- }
- if (childEditPart instanceof ConstraintSpecificationEditPartCN) {
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- return getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected NodeFigure createNodePlate() {
- RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(40, 40);
- return result;
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected NodeFigure createNodeFigure() {
- return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
-
- }
-
- /**
- * Default implementation treats passed figure as content pane.
- * Respects layout one may have set for generated figure.
- *
- * @param nodeShape
- * instance of generated figure class
- * @generated
- */
- @Override
- protected IFigure setupContentPane(IFigure nodeShape) {
- if (nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- @Override
- public IFigure getContentPane() {
- if (contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineWidth(int width) {
- super.setLineWidth(width);
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineType(int style) {
- if (primaryShape instanceof IPapyrusNodeFigure) {
- ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- @Override
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(ConstraintNameEditPartCN.VISUAL_ID));
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+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.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractConstraintEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ConstraintFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class ConstraintEditPartCN extends AbstractConstraintEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 56;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public ConstraintEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ // 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() {
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return primaryShape = new ConstraintFigure();
+ }
+
+ /**
+ * org.eclipse.papyrus.uml.diagram.common.figure.node.ConstraintFigure
+ *
+ * @generated
+ */
+ @Override
+ public ConstraintFigure getPrimaryShape() {
+ return (ConstraintFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ConstraintNameEditPartCN) {
+ ((ConstraintNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof ConstraintSpecificationEditPartCN) {
+ ((ConstraintSpecificationEditPartCN) childEditPart).setLabel(getPrimaryShape().getConstraintFigure());
+ return true;
+ }
+
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ConstraintNameEditPartCN) {
+ return true;
+ }
+ if (childEditPart instanceof ConstraintSpecificationEditPartCN) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodePlate() {
+ RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(40, 40);
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodeFigure() {
+ return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane.
+ * Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ @Override
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ super.setLineWidth(width);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(int style) {
+ if (primaryShape instanceof IPapyrusNodeFigure) {
+ ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(ConstraintNameEditPartCN.VISUAL_ID));
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintNameEditPart.java
index 4397c97360f..2f4b4c558bc 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintNameEditPart.java
@@ -1,871 +1,856 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 2;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public ConstraintNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Constraint_2005, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public ConstraintNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Constraint_2005, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintNameEditPart.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintNameEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintNameEditPartCN.java
index f631c2a2cbc..9659523481f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintNameEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintNameEditPartCN.java
@@ -1,871 +1,856 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 57;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public ConstraintNameEditPartCN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Constraint_56, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintNameEditPartCN.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class ConstraintNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 57;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public ConstraintNameEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Constraint_56, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintNameEditPartCN.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintSpecificationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintSpecificationEditPart.java
index a8663579a70..f5dca8eebd1 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintSpecificationEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintSpecificationEditPart.java
@@ -1,871 +1,856 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 3;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public ConstraintSpecificationEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Constraint_2005, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintSpecificationEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public ConstraintSpecificationEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Constraint_2005, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintSpecificationEditPart.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintSpecificationEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintSpecificationEditPartCN.java
index 3c22530c1eb..58b7717f1d7 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintSpecificationEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ConstraintSpecificationEditPartCN.java
@@ -1,871 +1,856 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 58;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public ConstraintSpecificationEditPartCN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Constraint_56, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintSpecificationEditPartCN.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class ConstraintSpecificationEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 58;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public ConstraintSpecificationEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Constraint_56, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintSpecificationEditPartCN.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DefaultNamedElementEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DefaultNamedElementEditPart.java
index aae0a47c4c1..e5fd137e89a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DefaultNamedElementEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DefaultNamedElementEditPart.java
@@ -1,285 +1,289 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.common.notify.Notification;
-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.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
-import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ChangeStereotypedShapeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.DeploymentDiagramChangeStereotypedShapeEditpolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.itemsemantic.CustomDefaultNamedElementItemSemanticEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.DefaultNamedElementItemSemanticEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class DefaultNamedElementEditPart extends NamedElementEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 2012;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public DefaultNamedElementEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultNamedElementItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy(ChangeStereotypedShapeEditPolicy.CHANGE_SHAPE_POLICY, new DeploymentDiagramChangeStereotypedShapeEditpolicy());
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomDefaultNamedElementItemSemanticEditPolicy());
- // 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() {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- @Override
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createNodeShape() {
- return primaryShape = new NodeNamedElementFigure();
- }
-
- /**
- * org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure
- *
- * @generated
- */
- @Override
- public NodeNamedElementFigure getPrimaryShape() {
- return (NodeNamedElementFigure) primaryShape;
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof DefaultNamedElementNameEditPart) {
- ((DefaultNamedElementNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
- return true;
- }
-
-
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof DefaultNamedElementNameEditPart) {
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- return getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected NodeFigure createNodePlate() {
- RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(100, 50);
- return result;
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected NodeFigure createNodeFigure() {
- return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
-
- }
-
- /**
- * Default implementation treats passed figure as content pane.
- * Respects layout one may have set for generated figure.
- *
- * @param nodeShape
- * instance of generated figure class
- * @generated
- */
- @Override
- protected IFigure setupContentPane(IFigure nodeShape) {
- if (nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- @Override
- public IFigure getContentPane() {
- if (contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineWidth(int width) {
- super.setLineWidth(width);
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineType(int style) {
- if (primaryShape instanceof IPapyrusNodeFigure) {
- ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- @Override
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(DefaultNamedElementNameEditPart.VISUAL_ID));
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+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.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ChangeStereotypedShapeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.DeploymentDiagramChangeStereotypedShapeEditpolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.itemsemantic.CustomDefaultNamedElementItemSemanticEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class DefaultNamedElementEditPart extends NamedElementEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2012;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public DefaultNamedElementEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
+ installEditPolicy(ChangeStereotypedShapeEditPolicy.CHANGE_SHAPE_POLICY, new DeploymentDiagramChangeStereotypedShapeEditpolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomDefaultNamedElementItemSemanticEditPolicy());
+ // 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() {
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return primaryShape = new NodeNamedElementFigure();
+ }
+
+ /**
+ * org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure
+ *
+ * @generated
+ */
+ @Override
+ public NodeNamedElementFigure getPrimaryShape() {
+ return (NodeNamedElementFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof DefaultNamedElementNameEditPart) {
+ ((DefaultNamedElementNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof DefaultNamedElementNameEditPart) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodePlate() {
+ RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(100, 50);
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodeFigure() {
+ return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane.
+ * Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ @Override
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ super.setLineWidth(width);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(int style) {
+ if (primaryShape instanceof IPapyrusNodeFigure) {
+ ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(DefaultNamedElementNameEditPart.VISUAL_ID));
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DefaultNamedElementNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DefaultNamedElementNameEditPart.java
index a9336cc894b..6e41b512184 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DefaultNamedElementNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DefaultNamedElementNameEditPart.java
@@ -1,888 +1,873 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
-import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 53;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public DefaultNamedElementNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- EObject parserElement = getParserElement();
- if (parserElement == null) {
- return null;
- }
- List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
- for (View view : views) {
- if (AppearanceHelper.showElementIcon(view)) {
- return UMLElementTypes.getImage(parserElement.eClass());
- }
- }
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.NamedElement_2012, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DefaultNamedElementNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(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();
- }
- }
- }
- if (event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation) event.getNewValue()).getSource())) {
- refreshLabel();
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.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.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
+import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 53;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public DefaultNamedElementNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
+ for (View view : views) {
+ if (AppearanceHelper.showElementIcon(view)) {
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.NamedElement_2012, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DefaultNamedElementNameEditPart.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(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();
+ }
+ }
+ }
+ if (event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation) event.getNewValue()).getSource())) {
+ refreshLabel();
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyAppliedStereotypeEditPart.java
index 5da184706cf..f8269578325 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyAppliedStereotypeEditPart.java
@@ -1,823 +1,823 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.ConnectionLocator;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultLinkLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class DependencyAppliedStereotypeEditPart extends AbstractLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 15;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
- /**
- * @generated
- */
- static {
- registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyAppliedStereotypeEditPart.VISUAL_ID), new Point(0, 60));
- }
-
- /**
- * @generated
- */
- public DependencyAppliedStereotypeEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultLinkLabelDragPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusLinkLabelDragPolicy());
- }
-
- /**
- * @generated
- */
- @Override
- public int getKeyPoint() {
- return ConnectionLocator.MIDDLE;
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Dependency_4004, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyAppliedStereotypeEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- 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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class DependencyAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 15;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyAppliedStereotypeEditPart.VISUAL_ID), new Point(0, 60));
+ }
+
+ /**
+ * @generated
+ */
+ public DependencyAppliedStereotypeEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusLinkLabelDragPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Dependency_4004, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyAppliedStereotypeEditPart.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ 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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public String getLabelRole() {
+ return "Stereotype";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ public String getIconPathRole() {
+ return "";//$NON-NLS-1$
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyBranchEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyBranchEditPart.java
index 22e8bc93e0b..830915a24db 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyBranchEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyBranchEditPart.java
@@ -1,71 +1,71 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import org.eclipse.draw2d.Connection;
-import org.eclipse.gef.EditPolicy;
-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.uml.diagram.common.editparts.UMLConnectionNodeEditPart;
-import org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.DependencyBranchItemSemanticEditPolicy;
-
-/**
- * @generated
- */
-public class DependencyBranchEditPart extends UMLConnectionNodeEditPart implements ITreeBranchEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 4010;
-
- /**
- * @generated
- */
- public DependencyBranchEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DependencyBranchItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected Connection createConnectionFigure() {
- return new DashedEdgeFigure();
- }
-
- /**
- * @generated
- */
- @Override
- public DashedEdgeFigure getPrimaryShape() {
- return (DashedEdgeFigure) getFigure();
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editparts.UMLConnectionNodeEditPart;
+import org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
+
+/**
+ * @generated
+ */
+public class DependencyBranchEditPart extends UMLConnectionNodeEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4010;
+
+ /**
+ * @generated
+ */
+ public DependencyBranchEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected Connection createConnectionFigure() {
+ return new DashedEdgeFigure();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public DashedEdgeFigure getPrimaryShape() {
+ return (DashedEdgeFigure) getFigure();
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyEditPart.java
index 09502a56c2f..c395ef7c129 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyEditPart.java
@@ -1,127 +1,126 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import org.eclipse.draw2d.Connection;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-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.uml.diagram.common.editparts.UMLConnectionNodeEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.DependencyItemSemanticEditPolicy;
-
-/**
- * @generated
- */
-public class DependencyEditPart extends UMLConnectionNodeEditPart implements ITreeBranchEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 4004;
-
- /**
- * @generated
- */
- public DependencyEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DependencyItemSemanticEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy());
- installEditPolicy(ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE, new ShowHideLabelEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof DependencyNameEditPart) {
- ((DependencyNameEditPart) childEditPart).setLabel(
- getPrimaryShape().getNameLabel());
- }
- if (childEditPart instanceof DependencyAppliedStereotypeEditPart) {
- ((DependencyAppliedStereotypeEditPart) childEditPart).setLabel(
- getPrimaryShape().getAppliedStereotypeLabel());
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof DependencyNameEditPart) {
- return true;
- }
- if (childEditPart instanceof DependencyAppliedStereotypeEditPart) {
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected Connection createConnectionFigure() {
- return new DashedEdgeFigure();
- }
-
- /**
- * @generated
- */
- @Override
- public DashedEdgeFigure getPrimaryShape() {
- return (DashedEdgeFigure) getFigure();
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editparts.UMLConnectionNodeEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
+
+/**
+ * @generated
+ */
+public class DependencyEditPart extends UMLConnectionNodeEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4004;
+
+ /**
+ * @generated
+ */
+ public DependencyEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+ installEditPolicy(AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy());
+ installEditPolicy(ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE, new ShowHideLabelEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof DependencyNameEditPart) {
+ ((DependencyNameEditPart) childEditPart).setLabel(
+ getPrimaryShape().getNameLabel());
+ }
+ if (childEditPart instanceof DependencyAppliedStereotypeEditPart) {
+ ((DependencyAppliedStereotypeEditPart) childEditPart).setLabel(
+ getPrimaryShape().getAppliedStereotypeLabel());
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof DependencyNameEditPart) {
+ return true;
+ }
+ if (childEditPart instanceof DependencyAppliedStereotypeEditPart) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected Connection createConnectionFigure() {
+ return new DashedEdgeFigure();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public DashedEdgeFigure getPrimaryShape() {
+ return (DashedEdgeFigure) getFigure();
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyNameEditPart.java
index 0feb7bb7a6f..e7a5c42666d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyNameEditPart.java
@@ -1,823 +1,823 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.ConnectionLocator;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultLinkLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 12;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
- /**
- * @generated
- */
- static {
- registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNameEditPart.VISUAL_ID), new Point(0, 40));
- }
-
- /**
- * @generated
- */
- public DependencyNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultLinkLabelDragPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusLinkLabelDragPolicy());
- }
-
- /**
- * @generated
- */
- @Override
- public int getKeyPoint() {
- return ConnectionLocator.MIDDLE;
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Dependency_4004, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- 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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class DependencyNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 12;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNameEditPart.VISUAL_ID), new Point(0, 40));
+ }
+
+ /**
+ * @generated
+ */
+ public DependencyNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusLinkLabelDragPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Dependency_4004, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNameEditPart.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ 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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public String getLabelRole() {
+ return "Name";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ public String getIconPathRole() {
+ return "";//$NON-NLS-1$
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyNodeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyNodeEditPart.java
index d8ef280bb84..6eb858fb668 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyNodeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DependencyNodeEditPart.java
@@ -1,244 +1,246 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Dimension;
-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.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.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.DependencyNodeFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.DependencyNodeItemSemanticEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class DependencyNodeEditPart extends NodeEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 2011;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public DependencyNodeEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DependencyNodeItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
- installEditPolicy(ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE, new ShowHideLabelEditPolicy());
- // 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() {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View) child.getModel();
- switch (UMLVisualIDRegistry.getVisualID(childView)) {
- case MultiDependencyLabelEditPart.VISUAL_ID:
- return new BorderItemSelectionEditPolicy() {
-
- @Override
- 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;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createNodeShape() {
- return primaryShape = new DependencyNodeFigure();
- }
-
- /**
- * org.eclipse.papyrus.uml.diagram.common.figure.node.DependencyNodeFigure
- *
- * @generated
- */
- @Override
- public DependencyNodeFigure getPrimaryShape() {
- return (DependencyNodeFigure) primaryShape;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
- if (borderItemEditPart instanceof MultiDependencyLabelEditPart) {
- BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH);
- locator.setBorderItemOffset(new Dimension(-20, -20));
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else
- {
- super.addBorderItem(borderItemContainer, borderItemEditPart);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected NodeFigure createNodePlate() {
- RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(10, 10);
- return result;
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected NodeFigure createMainFigure() {
- return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
-
- }
-
- /**
- * Default implementation treats passed figure as content pane.
- * Respects layout one may have set for generated figure.
- *
- * @param nodeShape
- * instance of generated figure class
- * @generated
- */
- @Override
- protected IFigure setupContentPane(IFigure nodeShape) {
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- @Override
- public IFigure getContentPane() {
- if (contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineWidth(int width) {
- super.setLineWidth(width);
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineType(int style) {
- if (primaryShape instanceof IPapyrusNodeFigure) {
- ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- @Override
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(MultiDependencyLabelEditPart.VISUAL_ID));
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.geometry.Dimension;
+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.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.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.DependencyNodeFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class DependencyNodeEditPart extends NodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2011;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public DependencyNodeEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ installEditPolicy(ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE, new ShowHideLabelEditPolicy());
+ // 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() {
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ View childView = (View) child.getModel();
+ switch (UMLVisualIDRegistry.getVisualID(childView)) {
+ case MultiDependencyLabelEditPart.VISUAL_ID:
+ return new BorderItemSelectionEditPolicy() {
+
+ @Override
+ 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;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return primaryShape = new DependencyNodeFigure();
+ }
+
+ /**
+ * org.eclipse.papyrus.uml.diagram.common.figure.node.DependencyNodeFigure
+ *
+ * @generated
+ */
+ @Override
+ public DependencyNodeFigure getPrimaryShape() {
+ return (DependencyNodeFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
+ if (borderItemEditPart instanceof MultiDependencyLabelEditPart) {
+ BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH);
+ locator.setBorderItemOffset(new Dimension(-20, -20));
+ borderItemContainer.add(borderItemEditPart.getFigure(), locator);
+ } else {
+ super.addBorderItem(borderItemContainer, borderItemEditPart);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodePlate() {
+ RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(10, 10);
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createMainFigure() {
+ return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane.
+ * Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ @Override
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ super.setLineWidth(width);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(int style) {
+ if (primaryShape instanceof IPapyrusNodeFigure) {
+ ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(MultiDependencyLabelEditPart.VISUAL_ID));
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentAppliedStereotypeEditPart.java
index 990228b1619..556efc11361 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentAppliedStereotypeEditPart.java
@@ -1,823 +1,823 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.ConnectionLocator;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultLinkLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class DeploymentAppliedStereotypeEditPart extends AbstractLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 14;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
- /**
- * @generated
- */
- static {
- registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentAppliedStereotypeEditPart.VISUAL_ID), new Point(0, 60));
- }
-
- /**
- * @generated
- */
- public DeploymentAppliedStereotypeEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultLinkLabelDragPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusLinkLabelDragPolicy());
- }
-
- /**
- * @generated
- */
- @Override
- public int getKeyPoint() {
- return ConnectionLocator.MIDDLE;
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Deployment_4001, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentAppliedStereotypeEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- 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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class DeploymentAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 14;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentAppliedStereotypeEditPart.VISUAL_ID), new Point(0, 60));
+ }
+
+ /**
+ * @generated
+ */
+ public DeploymentAppliedStereotypeEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusLinkLabelDragPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Deployment_4001, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentAppliedStereotypeEditPart.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ 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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public String getLabelRole() {
+ return "Stereotype";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ public String getIconPathRole() {
+ return "";//$NON-NLS-1$
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentDiagramEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentDiagramEditPart.java
index bc5f5df22be..c7a9f691e1f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentDiagramEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentDiagramEditPart.java
@@ -14,11 +14,11 @@ package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusDiagramEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.DeploymentDiagramItemSemanticEditPolicy;
/**
* @generated
@@ -49,12 +49,12 @@ public class DeploymentDiagramEditPart extends PapyrusDiagramEditPart {
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy());
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DeploymentDiagramItemSemanticEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ModelCanonicalEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ModelCanonicalEditPolicy());
installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentEditPart.java
index 9d31f8aa9c4..4ecbe2b4b9e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentEditPart.java
@@ -1,124 +1,123 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.uml.diagram.common.editparts.UMLConnectionNodeEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.DeploymentItemSemanticEditPolicy;
-
-/**
- * @generated
- */
-public class DeploymentEditPart extends UMLConnectionNodeEditPart implements ITreeBranchEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 4001;
-
- /**
- * @generated
- */
- public DeploymentEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DeploymentItemSemanticEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy());
- installEditPolicy(ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE, new ShowHideLabelEditPolicy());
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof DeploymentNameEditPart) {
- ((DeploymentNameEditPart) childEditPart).setLabel(
- getPrimaryShape().getNameLabel());
- }
- if (childEditPart instanceof DeploymentAppliedStereotypeEditPart) {
- ((DeploymentAppliedStereotypeEditPart) childEditPart).setLabel(
- getPrimaryShape().getAppliedStereotypeLabel());
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof DeploymentNameEditPart) {
- return true;
- }
- if (childEditPart instanceof DeploymentAppliedStereotypeEditPart) {
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected Connection createConnectionFigure() {
- return new DashedEdgeFigure();
- }
-
- /**
- * @generated
- */
- @Override
- public DashedEdgeFigure getPrimaryShape() {
- return (DashedEdgeFigure) getFigure();
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editparts.UMLConnectionNodeEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure;
+
+/**
+ * @generated
+ */
+public class DeploymentEditPart extends UMLConnectionNodeEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4001;
+
+ /**
+ * @generated
+ */
+ public DeploymentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+ installEditPolicy(AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy());
+ installEditPolicy(ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE, new ShowHideLabelEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof DeploymentNameEditPart) {
+ ((DeploymentNameEditPart) childEditPart).setLabel(
+ getPrimaryShape().getNameLabel());
+ }
+ if (childEditPart instanceof DeploymentAppliedStereotypeEditPart) {
+ ((DeploymentAppliedStereotypeEditPart) childEditPart).setLabel(
+ getPrimaryShape().getAppliedStereotypeLabel());
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof DeploymentNameEditPart) {
+ return true;
+ }
+ if (childEditPart instanceof DeploymentAppliedStereotypeEditPart) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected Connection createConnectionFigure() {
+ return new DashedEdgeFigure();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public DashedEdgeFigure getPrimaryShape() {
+ return (DashedEdgeFigure) getFigure();
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentNameEditPart.java
index cf4f8530ce9..777c87b62b5 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentNameEditPart.java
@@ -1,823 +1,823 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.ConnectionLocator;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultLinkLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 13;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
- /**
- * @generated
- */
- static {
- registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentNameEditPart.VISUAL_ID), new Point(0, 60));
- }
-
- /**
- * @generated
- */
- public DeploymentNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultLinkLabelDragPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusLinkLabelDragPolicy());
- }
-
- /**
- * @generated
- */
- @Override
- public int getKeyPoint() {
- return ConnectionLocator.MIDDLE;
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Deployment_4001, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- 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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class DeploymentNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 13;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentNameEditPart.VISUAL_ID), new Point(0, 60));
+ }
+
+ /**
+ * @generated
+ */
+ public DeploymentNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusLinkLabelDragPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Deployment_4001, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentNameEditPart.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ 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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public String getLabelRole() {
+ return "Name";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ public String getIconPathRole() {
+ return "";//$NON-NLS-1$
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceCompositeCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceCompositeCompartmentEditPart.java
index 92a7d12a4f8..816741355b3 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceCompositeCompartmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceCompositeCompartmentEditPart.java
@@ -25,11 +25,11 @@ import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
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.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.DeviceCompositeCompartmentItemSemanticEditPolicy;
import org.eclipse.papyrus.uml.diagram.deployment.part.Messages;
/**
@@ -63,12 +63,12 @@ public class DeviceCompositeCompartmentEditPart extends ShapeCompartmentEditPart
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DeviceCompositeCompartmentItemSemanticEditPolicy());
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.DeviceCompositeCompartmentCanonicalEditPolicy());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.DeviceCompositeCompartmentCanonicalEditPolicy());
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceCompositeCompartmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceCompositeCompartmentEditPartCN.java
index 81c71593238..81797c2cc67 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceCompositeCompartmentEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceCompositeCompartmentEditPartCN.java
@@ -26,11 +26,11 @@ import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditP
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.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.DeviceCompositeCompartmentItemSemanticEditPolicyCN;
import org.eclipse.papyrus.uml.diagram.deployment.part.Messages;
/**
@@ -65,12 +65,12 @@ public class DeviceCompositeCompartmentEditPartCN extends ShapeCompartmentEditPa
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DeviceCompositeCompartmentItemSemanticEditPolicyCN());
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.DeviceCompositeCompartmentCanonicalEditPolicyCN());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.DeviceCompositeCompartmentCanonicalEditPolicyCN());
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceEditPart.java
index 5b848adadea..8cf02b29f6a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceEditPart.java
@@ -1,305 +1,309 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.common.notify.Notification;
-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.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
-import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeviceFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.DeviceItemSemanticEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class DeviceEditPart extends NamedElementEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 2003;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public DeviceEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DeviceItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
- installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
- installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
- // 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() {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- @Override
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createNodeShape() {
- return primaryShape = new DeviceFigure();
- }
-
- /**
- * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeviceFigure
- *
- * @generated
- */
- @Override
- public DeviceFigure getPrimaryShape() {
- return (DeviceFigure) primaryShape;
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof DeviceNameEditPart) {
- ((DeviceNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
- return true;
- }
-
-
- if (childEditPart instanceof DeviceCompositeCompartmentEditPart) {
- IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
- setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
- pane.add(((DeviceCompositeCompartmentEditPart) childEditPart).getFigure());
- return true;
- }
-
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof DeviceNameEditPart) {
- return true;
- }
- if (childEditPart instanceof DeviceCompositeCompartmentEditPart) {
- IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
- pane.remove(((DeviceCompositeCompartmentEditPart) childEditPart).getFigure());
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- if (editPart instanceof DeviceCompositeCompartmentEditPart) {
- return getPrimaryShape().getCompositeCompartmentFigure();
- }
- return getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected NodeFigure createNodePlate() {
- RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 100);
- return result;
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected NodeFigure createNodeFigure() {
- return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
-
- }
-
- /**
- * Default implementation treats passed figure as content pane.
- * Respects layout one may have set for generated figure.
- *
- * @param nodeShape
- * instance of generated figure class
- * @generated
- */
- @Override
- protected IFigure setupContentPane(IFigure nodeShape) {
- if (nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- @Override
- public IFigure getContentPane() {
- if (contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineWidth(int width) {
- super.setLineWidth(width);
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineType(int style) {
- if (primaryShape instanceof IPapyrusNodeFigure) {
- ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- @Override
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(DeviceNameEditPart.VISUAL_ID));
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+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.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeviceFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class DeviceEditPart extends NamedElementEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2003;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public DeviceEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
+ installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
+ installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ // 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() {
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return primaryShape = new DeviceFigure();
+ }
+
+ /**
+ * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeviceFigure
+ *
+ * @generated
+ */
+ @Override
+ public DeviceFigure getPrimaryShape() {
+ return (DeviceFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof DeviceNameEditPart) {
+ ((DeviceNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+
+
+ if (childEditPart instanceof DeviceCompositeCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((DeviceCompositeCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof DeviceNameEditPart) {
+ return true;
+ }
+ if (childEditPart instanceof DeviceCompositeCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
+ pane.remove(((DeviceCompositeCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ if (editPart instanceof DeviceCompositeCompartmentEditPart) {
+ return getPrimaryShape().getCompositeCompartmentFigure();
+ }
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodePlate() {
+ RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 100);
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodeFigure() {
+ return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane.
+ * Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ @Override
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ super.setLineWidth(width);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(int style) {
+ if (primaryShape instanceof IPapyrusNodeFigure) {
+ ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(DeviceNameEditPart.VISUAL_ID));
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceEditPartCN.java
index e469c0ea93b..f15126b356f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceEditPartCN.java
@@ -1,290 +1,294 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.common.notify.Notification;
-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.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
-import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeviceFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.DeviceItemSemanticEditPolicyCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class DeviceEditPartCN extends NamedElementEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 16;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public DeviceEditPartCN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DeviceItemSemanticEditPolicyCN());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
- installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
- installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
- // 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() {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- @Override
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createNodeShape() {
- return primaryShape = new DeviceFigure();
- }
-
- /**
- * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeviceFigure
- *
- * @generated
- */
- @Override
- public DeviceFigure getPrimaryShape() {
- return (DeviceFigure) primaryShape;
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof DeviceNameEditPartCN) {
- ((DeviceNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
- return true;
- }
-
-
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof DeviceNameEditPartCN) {
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- return getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected NodeFigure createNodePlate() {
- RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 100);
- return result;
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected NodeFigure createNodeFigure() {
- return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
-
- }
-
- /**
- * Default implementation treats passed figure as content pane.
- * Respects layout one may have set for generated figure.
- *
- * @param nodeShape
- * instance of generated figure class
- * @generated
- */
- @Override
- protected IFigure setupContentPane(IFigure nodeShape) {
- if (nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- @Override
- public IFigure getContentPane() {
- if (contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineWidth(int width) {
- super.setLineWidth(width);
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineType(int style) {
- if (primaryShape instanceof IPapyrusNodeFigure) {
- ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- @Override
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(DeviceNameEditPartCN.VISUAL_ID));
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+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.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeviceFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class DeviceEditPartCN extends NamedElementEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 16;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public DeviceEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
+ installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
+ installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ // 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() {
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return primaryShape = new DeviceFigure();
+ }
+
+ /**
+ * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeviceFigure
+ *
+ * @generated
+ */
+ @Override
+ public DeviceFigure getPrimaryShape() {
+ return (DeviceFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof DeviceNameEditPartCN) {
+ ((DeviceNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof DeviceNameEditPartCN) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodePlate() {
+ RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 100);
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodeFigure() {
+ return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane.
+ * Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ @Override
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ super.setLineWidth(width);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(int style) {
+ if (primaryShape instanceof IPapyrusNodeFigure) {
+ ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(DeviceNameEditPartCN.VISUAL_ID));
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceNameEditPart.java
index b8d8793d648..5f76e6edb89 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceNameEditPart.java
@@ -1,871 +1,856 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 6;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public DeviceNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Device_2003, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class DeviceNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public DeviceNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Device_2003, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceNameEditPart.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceNameEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceNameEditPartCN.java
index 75680a7ec61..8c1cf2298cb 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceNameEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeviceNameEditPartCN.java
@@ -1,871 +1,856 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 20;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public DeviceNameEditPartCN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Device_16, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceNameEditPartCN.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class DeviceNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 20;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public DeviceNameEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Device_16, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceNameEditPartCN.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentCompositeCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentCompositeCompartmentEditPart.java
index 54d1d7e1fca..132ff151dda 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentCompositeCompartmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentCompositeCompartmentEditPart.java
@@ -25,11 +25,11 @@ import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
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.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicy;
import org.eclipse.papyrus.uml.diagram.deployment.part.Messages;
/**
@@ -63,12 +63,12 @@ public class ExecutionEnvironmentCompositeCompartmentEditPart extends ShapeCompa
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicy());
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicy());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicy());
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentCompositeCompartmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentCompositeCompartmentEditPartCN.java
index 6fdc32b4496..f13b17d5f8b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentCompositeCompartmentEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentCompositeCompartmentEditPartCN.java
@@ -26,11 +26,11 @@ import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditP
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.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicyCN;
import org.eclipse.papyrus.uml.diagram.deployment.part.Messages;
/**
@@ -65,12 +65,12 @@ public class ExecutionEnvironmentCompositeCompartmentEditPartCN extends ShapeCom
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicyCN());
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicyCN());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicyCN());
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentEditPart.java
index b2ae1e53c40..0a0aa6ff00c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentEditPart.java
@@ -1,305 +1,309 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.common.notify.Notification;
-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.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
-import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ExecutionEnvironmentFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ExecutionEnvironmentItemSemanticEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class ExecutionEnvironmentEditPart extends NamedElementEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 2002;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public ExecutionEnvironmentEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ExecutionEnvironmentItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
- installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
- installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
- // 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() {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- @Override
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createNodeShape() {
- return primaryShape = new ExecutionEnvironmentFigure();
- }
-
- /**
- * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ExecutionEnvironmentFigure
- *
- * @generated
- */
- @Override
- public ExecutionEnvironmentFigure getPrimaryShape() {
- return (ExecutionEnvironmentFigure) primaryShape;
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof ExecutionEnvironmentNameEditPart) {
- ((ExecutionEnvironmentNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
- return true;
- }
-
-
- if (childEditPart instanceof ExecutionEnvironmentCompositeCompartmentEditPart) {
- IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
- setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
- pane.add(((ExecutionEnvironmentCompositeCompartmentEditPart) childEditPart).getFigure());
- return true;
- }
-
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof ExecutionEnvironmentNameEditPart) {
- return true;
- }
- if (childEditPart instanceof ExecutionEnvironmentCompositeCompartmentEditPart) {
- IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
- pane.remove(((ExecutionEnvironmentCompositeCompartmentEditPart) childEditPart).getFigure());
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- if (editPart instanceof ExecutionEnvironmentCompositeCompartmentEditPart) {
- return getPrimaryShape().getCompositeCompartmentFigure();
- }
- return getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected NodeFigure createNodePlate() {
- RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 100);
- return result;
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected NodeFigure createNodeFigure() {
- return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
-
- }
-
- /**
- * Default implementation treats passed figure as content pane.
- * Respects layout one may have set for generated figure.
- *
- * @param nodeShape
- * instance of generated figure class
- * @generated
- */
- @Override
- protected IFigure setupContentPane(IFigure nodeShape) {
- if (nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- @Override
- public IFigure getContentPane() {
- if (contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineWidth(int width) {
- super.setLineWidth(width);
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineType(int style) {
- if (primaryShape instanceof IPapyrusNodeFigure) {
- ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- @Override
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(ExecutionEnvironmentNameEditPart.VISUAL_ID));
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+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.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ExecutionEnvironmentFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class ExecutionEnvironmentEditPart extends NamedElementEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2002;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public ExecutionEnvironmentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
+ installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
+ installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ // 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() {
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return primaryShape = new ExecutionEnvironmentFigure();
+ }
+
+ /**
+ * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ExecutionEnvironmentFigure
+ *
+ * @generated
+ */
+ @Override
+ public ExecutionEnvironmentFigure getPrimaryShape() {
+ return (ExecutionEnvironmentFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ExecutionEnvironmentNameEditPart) {
+ ((ExecutionEnvironmentNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+
+
+ if (childEditPart instanceof ExecutionEnvironmentCompositeCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((ExecutionEnvironmentCompositeCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ExecutionEnvironmentNameEditPart) {
+ return true;
+ }
+ if (childEditPart instanceof ExecutionEnvironmentCompositeCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
+ pane.remove(((ExecutionEnvironmentCompositeCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ if (editPart instanceof ExecutionEnvironmentCompositeCompartmentEditPart) {
+ return getPrimaryShape().getCompositeCompartmentFigure();
+ }
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodePlate() {
+ RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 100);
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodeFigure() {
+ return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane.
+ * Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ @Override
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ super.setLineWidth(width);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(int style) {
+ if (primaryShape instanceof IPapyrusNodeFigure) {
+ ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(ExecutionEnvironmentNameEditPart.VISUAL_ID));
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentEditPartCN.java
index 3a8fdbbb93d..ab63d8e533b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentEditPartCN.java
@@ -1,290 +1,294 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.common.notify.Notification;
-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.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
-import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ExecutionEnvironmentFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ExecutionEnvironmentItemSemanticEditPolicyCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class ExecutionEnvironmentEditPartCN extends NamedElementEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 21;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public ExecutionEnvironmentEditPartCN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ExecutionEnvironmentItemSemanticEditPolicyCN());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
- installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
- installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
- // 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() {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- @Override
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createNodeShape() {
- return primaryShape = new ExecutionEnvironmentFigure();
- }
-
- /**
- * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ExecutionEnvironmentFigure
- *
- * @generated
- */
- @Override
- public ExecutionEnvironmentFigure getPrimaryShape() {
- return (ExecutionEnvironmentFigure) primaryShape;
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof ExecutionEnvironmentNameEditPartCN) {
- ((ExecutionEnvironmentNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
- return true;
- }
-
-
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof ExecutionEnvironmentNameEditPartCN) {
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- return getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected NodeFigure createNodePlate() {
- RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 100);
- return result;
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected NodeFigure createNodeFigure() {
- return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
-
- }
-
- /**
- * Default implementation treats passed figure as content pane.
- * Respects layout one may have set for generated figure.
- *
- * @param nodeShape
- * instance of generated figure class
- * @generated
- */
- @Override
- protected IFigure setupContentPane(IFigure nodeShape) {
- if (nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- @Override
- public IFigure getContentPane() {
- if (contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineWidth(int width) {
- super.setLineWidth(width);
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineType(int style) {
- if (primaryShape instanceof IPapyrusNodeFigure) {
- ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- @Override
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(ExecutionEnvironmentNameEditPartCN.VISUAL_ID));
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+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.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ExecutionEnvironmentFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class ExecutionEnvironmentEditPartCN extends NamedElementEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 21;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public ExecutionEnvironmentEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
+ installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
+ installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ // 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() {
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return primaryShape = new ExecutionEnvironmentFigure();
+ }
+
+ /**
+ * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ExecutionEnvironmentFigure
+ *
+ * @generated
+ */
+ @Override
+ public ExecutionEnvironmentFigure getPrimaryShape() {
+ return (ExecutionEnvironmentFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ExecutionEnvironmentNameEditPartCN) {
+ ((ExecutionEnvironmentNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ExecutionEnvironmentNameEditPartCN) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodePlate() {
+ RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 100);
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodeFigure() {
+ return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane.
+ * Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ @Override
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ super.setLineWidth(width);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(int style) {
+ if (primaryShape instanceof IPapyrusNodeFigure) {
+ ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(ExecutionEnvironmentNameEditPartCN.VISUAL_ID));
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentNameEditPart.java
index 469117ccedb..c6b04bf6981 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentNameEditPart.java
@@ -1,871 +1,856 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 5;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public ExecutionEnvironmentNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.ExecutionEnvironment_2002, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class ExecutionEnvironmentNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public ExecutionEnvironmentNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.ExecutionEnvironment_2002, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentNameEditPart.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentNameEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentNameEditPartCN.java
index 600fccc89f7..83592a0d007 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentNameEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ExecutionEnvironmentNameEditPartCN.java
@@ -1,871 +1,856 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 22;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public ExecutionEnvironmentNameEditPartCN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.ExecutionEnvironment_21, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentNameEditPartCN.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class ExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 22;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public ExecutionEnvironmentNameEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.ExecutionEnvironment_21, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentNameEditPartCN.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/GeneralizationAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/GeneralizationAppliedStereotypeEditPart.java
index 498779779c7..286d9112809 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/GeneralizationAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/GeneralizationAppliedStereotypeEditPart.java
@@ -1,815 +1,815 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.ConnectionLocator;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultLinkLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class GeneralizationAppliedStereotypeEditPart extends AbstractLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 4;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
- /**
- * @generated
- */
- static {
- registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationAppliedStereotypeEditPart.VISUAL_ID), new Point(0, 60));
- }
-
- /**
- * @generated
- */
- public GeneralizationAppliedStereotypeEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultLinkLabelDragPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusLinkLabelDragPolicy());
- }
-
- /**
- * @generated
- */
- @Override
- public int getKeyPoint() {
- return ConnectionLocator.MIDDLE;
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Generalization_4003, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationAppliedStereotypeEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- // The label is read-only (defined in GMFGen model)
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- 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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class GeneralizationAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationAppliedStereotypeEditPart.VISUAL_ID), new Point(0, 60));
+ }
+
+ /**
+ * @generated
+ */
+ public GeneralizationAppliedStereotypeEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusLinkLabelDragPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Generalization_4003, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationAppliedStereotypeEditPart.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ // The label is read-only (defined in GMFGen model)
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ 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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public String getLabelRole() {
+ return "Stereotype";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ public String getIconPathRole() {
+ return "";//$NON-NLS-1$
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/GeneralizationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/GeneralizationEditPart.java
index 44f177d880d..158e510ac73 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/GeneralizationEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/GeneralizationEditPart.java
@@ -1,117 +1,116 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.uml.diagram.common.editparts.UMLConnectionNodeEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.edge.GeneralizationFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.GeneralizationItemSemanticEditPolicy;
-
-/**
- * @generated
- */
-public class GeneralizationEditPart extends UMLConnectionNodeEditPart implements ITreeBranchEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 4003;
-
- /**
- * @generated
- */
- public GeneralizationEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new GeneralizationItemSemanticEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy());
- installEditPolicy(ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE, new ShowHideLabelEditPolicy());
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof GeneralizationAppliedStereotypeEditPart) {
- ((GeneralizationAppliedStereotypeEditPart) childEditPart).setLabel(
- getPrimaryShape().getAppliedStereotypeLabel());
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof GeneralizationAppliedStereotypeEditPart) {
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected Connection createConnectionFigure() {
- return new GeneralizationFigure();
- }
-
- /**
- * @generated
- */
- @Override
- public GeneralizationFigure getPrimaryShape() {
- return (GeneralizationFigure) getFigure();
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editparts.UMLConnectionNodeEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.figure.edge.GeneralizationFigure;
+
+/**
+ * @generated
+ */
+public class GeneralizationEditPart extends UMLConnectionNodeEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4003;
+
+ /**
+ * @generated
+ */
+ public GeneralizationEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+ installEditPolicy(AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy());
+ installEditPolicy(ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE, new ShowHideLabelEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof GeneralizationAppliedStereotypeEditPart) {
+ ((GeneralizationAppliedStereotypeEditPart) childEditPart).setLabel(
+ getPrimaryShape().getAppliedStereotypeLabel());
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof GeneralizationAppliedStereotypeEditPart) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected Connection createConnectionFigure() {
+ return new GeneralizationFigure();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public GeneralizationFigure getPrimaryShape() {
+ return (GeneralizationFigure) getFigure();
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/LinkDescriptorEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/LinkDescriptorEditPart.java
index f878513488c..6151ccfaa87 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/LinkDescriptorEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/LinkDescriptorEditPart.java
@@ -1,70 +1,70 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import org.eclipse.draw2d.Connection;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ViewComponentEditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart;
-import org.eclipse.papyrus.uml.diagram.common.figure.edge.SimpleDashedEdgeFigure;
-
-/**
- * @generated
- */
-public class LinkDescriptorEditPart extends ConnectionEditPart implements ITreeBranchEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 4005;
-
- /**
- * @generated
- */
- public LinkDescriptorEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.COMPONENT_ROLE, new ViewComponentEditPolicy());
- removeEditPolicy(EditPolicyRoles.SEMANTIC_ROLE);
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected Connection createConnectionFigure() {
- return new SimpleDashedEdgeFigure();
- }
-
- /**
- * @generated
- */
- @Override
- public SimpleDashedEdgeFigure getPrimaryShape() {
- return (SimpleDashedEdgeFigure) getFigure();
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ViewComponentEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart;
+import org.eclipse.papyrus.uml.diagram.common.figure.edge.SimpleDashedEdgeFigure;
+
+/**
+ * @generated
+ */
+public class LinkDescriptorEditPart extends ConnectionEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4005;
+
+ /**
+ * @generated
+ */
+ public LinkDescriptorEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ViewComponentEditPolicy());
+ removeEditPolicy(EditPolicyRoles.SEMANTIC_ROLE);
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected Connection createConnectionFigure() {
+ return new SimpleDashedEdgeFigure();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public SimpleDashedEdgeFigure getPrimaryShape() {
+ return (SimpleDashedEdgeFigure) getFigure();
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationAppliedStereotypeEditPart.java
index 58c65476b83..e802c7dcac1 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationAppliedStereotypeEditPart.java
@@ -1,823 +1,823 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.ConnectionLocator;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultLinkLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class ManifestationAppliedStereotypeEditPart extends AbstractLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 11;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
- /**
- * @generated
- */
- static {
- registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationAppliedStereotypeEditPart.VISUAL_ID), new Point(0, 30));
- }
-
- /**
- * @generated
- */
- public ManifestationAppliedStereotypeEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultLinkLabelDragPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusLinkLabelDragPolicy());
- }
-
- /**
- * @generated
- */
- @Override
- public int getKeyPoint() {
- return ConnectionLocator.MIDDLE;
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Manifestation_4002, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationAppliedStereotypeEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- 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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class ManifestationAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 11;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationAppliedStereotypeEditPart.VISUAL_ID), new Point(0, 30));
+ }
+
+ /**
+ * @generated
+ */
+ public ManifestationAppliedStereotypeEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusLinkLabelDragPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Manifestation_4002, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationAppliedStereotypeEditPart.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ 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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public String getLabelRole() {
+ return "Stereotype";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ public String getIconPathRole() {
+ return "";//$NON-NLS-1$
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationEditPart.java
index f4830eea216..3ad1410bb21 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationEditPart.java
@@ -1,124 +1,123 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.uml.diagram.common.editparts.UMLConnectionNodeEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ManifestationItemSemanticEditPolicy;
-
-/**
- * @generated
- */
-public class ManifestationEditPart extends UMLConnectionNodeEditPart implements ITreeBranchEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 4002;
-
- /**
- * @generated
- */
- public ManifestationEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ManifestationItemSemanticEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy());
- installEditPolicy(ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE, new ShowHideLabelEditPolicy());
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof ManifestationNameEditPart) {
- ((ManifestationNameEditPart) childEditPart).setLabel(
- getPrimaryShape().getNameLabel());
- }
- if (childEditPart instanceof ManifestationAppliedStereotypeEditPart) {
- ((ManifestationAppliedStereotypeEditPart) childEditPart).setLabel(
- getPrimaryShape().getAppliedStereotypeLabel());
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof ManifestationNameEditPart) {
- return true;
- }
- if (childEditPart instanceof ManifestationAppliedStereotypeEditPart) {
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected Connection createConnectionFigure() {
- return new DashedEdgeFigure();
- }
-
- /**
- * @generated
- */
- @Override
- public DashedEdgeFigure getPrimaryShape() {
- return (DashedEdgeFigure) getFigure();
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editparts.UMLConnectionNodeEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure;
+
+/**
+ * @generated
+ */
+public class ManifestationEditPart extends UMLConnectionNodeEditPart implements ITreeBranchEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4002;
+
+ /**
+ * @generated
+ */
+ public ManifestationEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+ installEditPolicy(AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy());
+ installEditPolicy(ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE, new ShowHideLabelEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ManifestationNameEditPart) {
+ ((ManifestationNameEditPart) childEditPart).setLabel(
+ getPrimaryShape().getNameLabel());
+ }
+ if (childEditPart instanceof ManifestationAppliedStereotypeEditPart) {
+ ((ManifestationAppliedStereotypeEditPart) childEditPart).setLabel(
+ getPrimaryShape().getAppliedStereotypeLabel());
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ManifestationNameEditPart) {
+ return true;
+ }
+ if (childEditPart instanceof ManifestationAppliedStereotypeEditPart) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected Connection createConnectionFigure() {
+ return new DashedEdgeFigure();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public DashedEdgeFigure getPrimaryShape() {
+ return (DashedEdgeFigure) getFigure();
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationNameEditPart.java
index 7886c2ab777..3baebd4a02c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ManifestationNameEditPart.java
@@ -1,823 +1,823 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.ConnectionLocator;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultLinkLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class ManifestationNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 10;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
- /**
- * @generated
- */
- static {
- registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationNameEditPart.VISUAL_ID), new Point(0, 60));
- }
-
- /**
- * @generated
- */
- public ManifestationNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultLinkLabelDragPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusLinkLabelDragPolicy());
- }
-
- /**
- * @generated
- */
- @Override
- public int getKeyPoint() {
- return ConnectionLocator.MIDDLE;
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Manifestation_4002, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- 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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class ManifestationNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit, ILabelRoleProvider {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 10;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationNameEditPart.VISUAL_ID), new Point(0, 60));
+ }
+
+ /**
+ * @generated
+ */
+ public ManifestationNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusLinkLabelDragPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Manifestation_4002, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationNameEditPart.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ 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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public String getLabelRole() {
+ return "Name";//$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ public String getIconPathRole() {
+ return "";//$NON-NLS-1$
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelEditPart.java
index 30ed52c950b..1cd1dea0015 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelEditPart.java
@@ -1,299 +1,303 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.common.notify.Notification;
-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.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
-import org.eclipse.papyrus.uml.diagram.common.editparts.PackageEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ModelItemSemanticEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class ModelEditPart extends PackageEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 2010;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public ModelEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ModelItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
- installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
- // 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() {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- @Override
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createNodeShape() {
- return primaryShape = new PackageFigure();
- }
-
- /**
- * org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure
- *
- * @generated
- */
- @Override
- public PackageFigure getPrimaryShape() {
- return (PackageFigure) primaryShape;
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof ModelNameEditPart) {
- ((ModelNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
- return true;
- }
-
-
- if (childEditPart instanceof ModelPackageableElementCompartmentEditPart) {
- IFigure pane = getPrimaryShape().getPackageableElementFigure();
- setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
- pane.add(((ModelPackageableElementCompartmentEditPart) childEditPart).getFigure());
- return true;
- }
-
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof ModelNameEditPart) {
- return true;
- }
- if (childEditPart instanceof ModelPackageableElementCompartmentEditPart) {
- IFigure pane = getPrimaryShape().getPackageableElementFigure();
- pane.remove(((ModelPackageableElementCompartmentEditPart) childEditPart).getFigure());
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- if (editPart instanceof ModelPackageableElementCompartmentEditPart) {
- return getPrimaryShape().getPackageableElementFigure();
- }
- return getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected NodeFigure createNodePlate() {
- RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 150);
- return result;
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected NodeFigure createNodeFigure() {
- return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
-
- }
-
- /**
- * Default implementation treats passed figure as content pane.
- * Respects layout one may have set for generated figure.
- *
- * @param nodeShape
- * instance of generated figure class
- * @generated
- */
- @Override
- protected IFigure setupContentPane(IFigure nodeShape) {
- if (nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- @Override
- public IFigure getContentPane() {
- if (contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineWidth(int width) {
- super.setLineWidth(width);
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineType(int style) {
- if (primaryShape instanceof IPapyrusNodeFigure) {
- ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- @Override
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(ModelNameEditPart.VISUAL_ID));
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+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.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.PackageEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class ModelEditPart extends PackageEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2010;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public ModelEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ // 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() {
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return primaryShape = new PackageFigure();
+ }
+
+ /**
+ * org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure
+ *
+ * @generated
+ */
+ @Override
+ public PackageFigure getPrimaryShape() {
+ return (PackageFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ModelNameEditPart) {
+ ((ModelNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+
+
+ if (childEditPart instanceof ModelPackageableElementCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getPackageableElementFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((ModelPackageableElementCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ModelNameEditPart) {
+ return true;
+ }
+ if (childEditPart instanceof ModelPackageableElementCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getPackageableElementFigure();
+ pane.remove(((ModelPackageableElementCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ if (editPart instanceof ModelPackageableElementCompartmentEditPart) {
+ return getPrimaryShape().getPackageableElementFigure();
+ }
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodePlate() {
+ RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 150);
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodeFigure() {
+ return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane.
+ * Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ @Override
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ super.setLineWidth(width);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(int style) {
+ if (primaryShape instanceof IPapyrusNodeFigure) {
+ ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(ModelNameEditPart.VISUAL_ID));
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelEditPartCN.java
index 981f051b962..6d8cde60858 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelEditPartCN.java
@@ -1,299 +1,303 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.common.notify.Notification;
-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.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
-import org.eclipse.papyrus.uml.diagram.common.editparts.PackageEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ModelItemSemanticEditPolicyCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class ModelEditPartCN extends PackageEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 49;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public ModelEditPartCN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ModelItemSemanticEditPolicyCN());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
- installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
- // 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() {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- @Override
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createNodeShape() {
- return primaryShape = new PackageFigure();
- }
-
- /**
- * org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure
- *
- * @generated
- */
- @Override
- public PackageFigure getPrimaryShape() {
- return (PackageFigure) primaryShape;
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof ModelNameEditPartCN) {
- ((ModelNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
- return true;
- }
-
-
- if (childEditPart instanceof ModelPackageableElementCompartmentEditPartCN) {
- IFigure pane = getPrimaryShape().getPackageableElementFigure();
- setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
- pane.add(((ModelPackageableElementCompartmentEditPartCN) childEditPart).getFigure());
- return true;
- }
-
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof ModelNameEditPartCN) {
- return true;
- }
- if (childEditPart instanceof ModelPackageableElementCompartmentEditPartCN) {
- IFigure pane = getPrimaryShape().getPackageableElementFigure();
- pane.remove(((ModelPackageableElementCompartmentEditPartCN) childEditPart).getFigure());
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- if (editPart instanceof ModelPackageableElementCompartmentEditPartCN) {
- return getPrimaryShape().getPackageableElementFigure();
- }
- return getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected NodeFigure createNodePlate() {
- RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 150);
- return result;
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected NodeFigure createNodeFigure() {
- return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
-
- }
-
- /**
- * Default implementation treats passed figure as content pane.
- * Respects layout one may have set for generated figure.
- *
- * @param nodeShape
- * instance of generated figure class
- * @generated
- */
- @Override
- protected IFigure setupContentPane(IFigure nodeShape) {
- if (nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- @Override
- public IFigure getContentPane() {
- if (contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineWidth(int width) {
- super.setLineWidth(width);
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineType(int style) {
- if (primaryShape instanceof IPapyrusNodeFigure) {
- ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- @Override
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(ModelNameEditPartCN.VISUAL_ID));
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+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.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.PackageEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class ModelEditPartCN extends PackageEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 49;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public ModelEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ // 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() {
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return primaryShape = new PackageFigure();
+ }
+
+ /**
+ * org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure
+ *
+ * @generated
+ */
+ @Override
+ public PackageFigure getPrimaryShape() {
+ return (PackageFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ModelNameEditPartCN) {
+ ((ModelNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+
+
+ if (childEditPart instanceof ModelPackageableElementCompartmentEditPartCN) {
+ IFigure pane = getPrimaryShape().getPackageableElementFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((ModelPackageableElementCompartmentEditPartCN) childEditPart).getFigure());
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof ModelNameEditPartCN) {
+ return true;
+ }
+ if (childEditPart instanceof ModelPackageableElementCompartmentEditPartCN) {
+ IFigure pane = getPrimaryShape().getPackageableElementFigure();
+ pane.remove(((ModelPackageableElementCompartmentEditPartCN) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ if (editPart instanceof ModelPackageableElementCompartmentEditPartCN) {
+ return getPrimaryShape().getPackageableElementFigure();
+ }
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodePlate() {
+ RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 150);
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodeFigure() {
+ return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane.
+ * Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ @Override
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ super.setLineWidth(width);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(int style) {
+ if (primaryShape instanceof IPapyrusNodeFigure) {
+ ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(ModelNameEditPartCN.VISUAL_ID));
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelNameEditPart.java
index 5af547d1f4a..2feeeb18e1c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelNameEditPart.java
@@ -1,888 +1,873 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
-import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 48;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public ModelNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- EObject parserElement = getParserElement();
- if (parserElement == null) {
- return null;
- }
- List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
- for (View view : views) {
- if (AppearanceHelper.showElementIcon(view)) {
- return UMLElementTypes.getImage(parserElement.eClass());
- }
- }
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Model_2010, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(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();
- }
- }
- }
- if (event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation) event.getNewValue()).getSource())) {
- refreshLabel();
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.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.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
+import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 48;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public ModelNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
+ for (View view : views) {
+ if (AppearanceHelper.showElementIcon(view)) {
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Model_2010, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelNameEditPart.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(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();
+ }
+ }
+ }
+ if (event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation) event.getNewValue()).getSource())) {
+ refreshLabel();
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelNameEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelNameEditPartCN.java
index 4480ade1340..0839cb2e460 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelNameEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelNameEditPartCN.java
@@ -1,888 +1,873 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
-import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 50;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public ModelNameEditPartCN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- EObject parserElement = getParserElement();
- if (parserElement == null) {
- return null;
- }
- List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
- for (View view : views) {
- if (AppearanceHelper.showElementIcon(view)) {
- return UMLElementTypes.getImage(parserElement.eClass());
- }
- }
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Model_49, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelNameEditPartCN.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(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();
- }
- }
- }
- if (event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation) event.getNewValue()).getSource())) {
- refreshLabel();
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.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.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
+import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 50;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public ModelNameEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
+ for (View view : views) {
+ if (AppearanceHelper.showElementIcon(view)) {
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Model_49, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelNameEditPartCN.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(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();
+ }
+ }
+ }
+ if (event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation) event.getNewValue()).getSource())) {
+ refreshLabel();
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelPackageableElementCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelPackageableElementCompartmentEditPart.java
index 7a520db9840..166bfb5fe0e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelPackageableElementCompartmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelPackageableElementCompartmentEditPart.java
@@ -25,11 +25,11 @@ import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
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.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ModelPackageableElementCompartmentItemSemanticEditPolicy;
import org.eclipse.papyrus.uml.diagram.deployment.part.Messages;
/**
@@ -63,12 +63,12 @@ public class ModelPackageableElementCompartmentEditPart extends ShapeCompartment
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ModelPackageableElementCompartmentItemSemanticEditPolicy());
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ModelPackageableElementCompartmentCanonicalEditPolicy());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ModelPackageableElementCompartmentCanonicalEditPolicy());
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelPackageableElementCompartmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelPackageableElementCompartmentEditPartCN.java
index 80576051c55..07c8acf09f2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelPackageableElementCompartmentEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/ModelPackageableElementCompartmentEditPartCN.java
@@ -25,11 +25,11 @@ import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
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.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ModelPackageableElementCompartmentItemSemanticEditPolicyCN;
import org.eclipse.papyrus.uml.diagram.deployment.part.Messages;
/**
@@ -63,12 +63,12 @@ public class ModelPackageableElementCompartmentEditPartCN extends ShapeCompartme
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ModelPackageableElementCompartmentItemSemanticEditPolicyCN());
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ModelPackageableElementCompartmentCanonicalEditPolicyCN());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.ModelPackageableElementCompartmentCanonicalEditPolicyCN());
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/MultiDependencyLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/MultiDependencyLabelEditPart.java
index 684fbc9ccf2..c9318363183 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/MultiDependencyLabelEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/MultiDependencyLabelEditPart.java
@@ -1,852 +1,838 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 7;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
- /**
- * @generated
- */
- static {
- registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.MultiDependencyLabelEditPart.VISUAL_ID), new Point(0, 0));
- }
-
- /**
- * @generated
- */
- public MultiDependencyLabelEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- 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 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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Dependency_2011, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.MultiDependencyLabelEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- 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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- /**
- * @generated
- */
- protected IFigure createFigurePrim() {
- return new WrappingLabel();
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 7;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.MultiDependencyLabelEditPart.VISUAL_ID), new Point(0, 0));
+ }
+
+ /**
+ * @generated
+ */
+ public MultiDependencyLabelEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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 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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Dependency_2011, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.MultiDependencyLabelEditPart.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ 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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new WrappingLabel();
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedArtifactNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedArtifactNameEditPart.java
index 0148cffc629..9ab1a5a43cb 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedArtifactNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedArtifactNameEditPart.java
@@ -1,871 +1,856 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 41;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public NestedArtifactNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Artifact_40, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedArtifactNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class NestedArtifactNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 41;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public NestedArtifactNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Artifact_40, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedArtifactNameEditPart.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedArtifactNodeEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedArtifactNodeEditPartCN.java
index 7d53ed6db5d..00abb51046f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedArtifactNodeEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedArtifactNodeEditPartCN.java
@@ -1,276 +1,280 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-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.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ArtifactFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.NestedArtifactNodeItemSemanticEditPolicyCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class NestedArtifactNodeEditPartCN extends NodeEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 40;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public NestedArtifactNodeEditPartCN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new NestedArtifactNodeItemSemanticEditPolicyCN());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
- installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
- installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
- // 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() {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createNodeShape() {
- return primaryShape = new ArtifactFigure();
- }
-
- /**
- * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ArtifactFigure
- *
- * @generated
- */
- @Override
- public ArtifactFigure getPrimaryShape() {
- return (ArtifactFigure) primaryShape;
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof NestedArtifactNameEditPart) {
- ((NestedArtifactNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
- return true;
- }
-
-
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof NestedArtifactNameEditPart) {
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- return getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected NodeFigure createNodePlate() {
- RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 70);
- return result;
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected NodeFigure createNodeFigure() {
- return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
-
- }
-
- /**
- * Default implementation treats passed figure as content pane.
- * Respects layout one may have set for generated figure.
- *
- * @param nodeShape
- * instance of generated figure class
- * @generated
- */
- @Override
- protected IFigure setupContentPane(IFigure nodeShape) {
- if (nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- @Override
- public IFigure getContentPane() {
- if (contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineWidth(int width) {
- super.setLineWidth(width);
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineType(int style) {
- if (primaryShape instanceof IPapyrusNodeFigure) {
- ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- @Override
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(NestedArtifactNameEditPart.VISUAL_ID));
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+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.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ArtifactFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class NestedArtifactNodeEditPartCN extends NodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 40;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public NestedArtifactNodeEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
+ installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
+ installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ // 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() {
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return primaryShape = new ArtifactFigure();
+ }
+
+ /**
+ * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ArtifactFigure
+ *
+ * @generated
+ */
+ @Override
+ public ArtifactFigure getPrimaryShape() {
+ return (ArtifactFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof NestedArtifactNameEditPart) {
+ ((NestedArtifactNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof NestedArtifactNameEditPart) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodePlate() {
+ RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 70);
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodeFigure() {
+ return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane.
+ * Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ @Override
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ super.setLineWidth(width);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(int style) {
+ if (primaryShape instanceof IPapyrusNodeFigure) {
+ ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(NestedArtifactNameEditPart.VISUAL_ID));
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedDeviceEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedDeviceEditPartCN.java
index 7f5e64af65a..492626257e0 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedDeviceEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedDeviceEditPartCN.java
@@ -1,293 +1,297 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-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.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeviceFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.NestedDeviceItemSemanticEditPolicyCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class NestedDeviceEditPartCN extends NodeEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 44;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public NestedDeviceEditPartCN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new NestedDeviceItemSemanticEditPolicyCN());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
- installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
- installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
- // 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() {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createNodeShape() {
- return primaryShape = new DeviceFigure();
- }
-
- /**
- * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeviceFigure
- *
- * @generated
- */
- @Override
- public DeviceFigure getPrimaryShape() {
- return (DeviceFigure) primaryShape;
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof NestedDeviceNameEditPartCN) {
- ((NestedDeviceNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
- return true;
- }
-
-
- if (childEditPart instanceof DeviceCompositeCompartmentEditPartCN) {
- IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
- setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
- pane.add(((DeviceCompositeCompartmentEditPartCN) childEditPart).getFigure());
- return true;
- }
-
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof NestedDeviceNameEditPartCN) {
- return true;
- }
- if (childEditPart instanceof DeviceCompositeCompartmentEditPartCN) {
- IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
- pane.remove(((DeviceCompositeCompartmentEditPartCN) childEditPart).getFigure());
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- if (editPart instanceof DeviceCompositeCompartmentEditPartCN) {
- return getPrimaryShape().getCompositeCompartmentFigure();
- }
- return getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected NodeFigure createNodePlate() {
- RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 100);
- return result;
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected NodeFigure createNodeFigure() {
- return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
-
- }
-
- /**
- * Default implementation treats passed figure as content pane.
- * Respects layout one may have set for generated figure.
- *
- * @param nodeShape
- * instance of generated figure class
- * @generated
- */
- @Override
- protected IFigure setupContentPane(IFigure nodeShape) {
- if (nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- @Override
- public IFigure getContentPane() {
- if (contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineWidth(int width) {
- super.setLineWidth(width);
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineType(int style) {
- if (primaryShape instanceof IPapyrusNodeFigure) {
- ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- @Override
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(NestedDeviceNameEditPartCN.VISUAL_ID));
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+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.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeviceFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class NestedDeviceEditPartCN extends NodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 44;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public NestedDeviceEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
+ installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
+ installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ // 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() {
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return primaryShape = new DeviceFigure();
+ }
+
+ /**
+ * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeviceFigure
+ *
+ * @generated
+ */
+ @Override
+ public DeviceFigure getPrimaryShape() {
+ return (DeviceFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof NestedDeviceNameEditPartCN) {
+ ((NestedDeviceNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+
+
+ if (childEditPart instanceof DeviceCompositeCompartmentEditPartCN) {
+ IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((DeviceCompositeCompartmentEditPartCN) childEditPart).getFigure());
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof NestedDeviceNameEditPartCN) {
+ return true;
+ }
+ if (childEditPart instanceof DeviceCompositeCompartmentEditPartCN) {
+ IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
+ pane.remove(((DeviceCompositeCompartmentEditPartCN) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ if (editPart instanceof DeviceCompositeCompartmentEditPartCN) {
+ return getPrimaryShape().getCompositeCompartmentFigure();
+ }
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodePlate() {
+ RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 100);
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodeFigure() {
+ return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane.
+ * Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ @Override
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ super.setLineWidth(width);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(int style) {
+ if (primaryShape instanceof IPapyrusNodeFigure) {
+ ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(NestedDeviceNameEditPartCN.VISUAL_ID));
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedDeviceNameEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedDeviceNameEditPartCN.java
index d6b94256014..52e2f24ea0d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedDeviceNameEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedDeviceNameEditPartCN.java
@@ -1,871 +1,856 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 45;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public NestedDeviceNameEditPartCN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Device_44, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedDeviceNameEditPartCN.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class NestedDeviceNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 45;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public NestedDeviceNameEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Device_44, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedDeviceNameEditPartCN.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedExecutionEnvironmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedExecutionEnvironmentEditPartCN.java
index d4f241e17e0..edc34e77914 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedExecutionEnvironmentEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedExecutionEnvironmentEditPartCN.java
@@ -1,293 +1,297 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-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.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ExecutionEnvironmentFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.NestedExecutionEnvironmentItemSemanticEditPolicyCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class NestedExecutionEnvironmentEditPartCN extends NodeEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 46;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public NestedExecutionEnvironmentEditPartCN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new NestedExecutionEnvironmentItemSemanticEditPolicyCN());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
- installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
- installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
- // 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() {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createNodeShape() {
- return primaryShape = new ExecutionEnvironmentFigure();
- }
-
- /**
- * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ExecutionEnvironmentFigure
- *
- * @generated
- */
- @Override
- public ExecutionEnvironmentFigure getPrimaryShape() {
- return (ExecutionEnvironmentFigure) primaryShape;
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof NestedExecutionEnvironmentNameEditPartCN) {
- ((NestedExecutionEnvironmentNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
- return true;
- }
-
-
- if (childEditPart instanceof ExecutionEnvironmentCompositeCompartmentEditPartCN) {
- IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
- setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
- pane.add(((ExecutionEnvironmentCompositeCompartmentEditPartCN) childEditPart).getFigure());
- return true;
- }
-
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof NestedExecutionEnvironmentNameEditPartCN) {
- return true;
- }
- if (childEditPart instanceof ExecutionEnvironmentCompositeCompartmentEditPartCN) {
- IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
- pane.remove(((ExecutionEnvironmentCompositeCompartmentEditPartCN) childEditPart).getFigure());
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- if (editPart instanceof ExecutionEnvironmentCompositeCompartmentEditPartCN) {
- return getPrimaryShape().getCompositeCompartmentFigure();
- }
- return getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected NodeFigure createNodePlate() {
- RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 100);
- return result;
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected NodeFigure createNodeFigure() {
- return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
-
- }
-
- /**
- * Default implementation treats passed figure as content pane.
- * Respects layout one may have set for generated figure.
- *
- * @param nodeShape
- * instance of generated figure class
- * @generated
- */
- @Override
- protected IFigure setupContentPane(IFigure nodeShape) {
- if (nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- @Override
- public IFigure getContentPane() {
- if (contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineWidth(int width) {
- super.setLineWidth(width);
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineType(int style) {
- if (primaryShape instanceof IPapyrusNodeFigure) {
- ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- @Override
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(NestedExecutionEnvironmentNameEditPartCN.VISUAL_ID));
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+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.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ExecutionEnvironmentFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class NestedExecutionEnvironmentEditPartCN extends NodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 46;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public NestedExecutionEnvironmentEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
+ installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
+ installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ // 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() {
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return primaryShape = new ExecutionEnvironmentFigure();
+ }
+
+ /**
+ * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.ExecutionEnvironmentFigure
+ *
+ * @generated
+ */
+ @Override
+ public ExecutionEnvironmentFigure getPrimaryShape() {
+ return (ExecutionEnvironmentFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof NestedExecutionEnvironmentNameEditPartCN) {
+ ((NestedExecutionEnvironmentNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+
+
+ if (childEditPart instanceof ExecutionEnvironmentCompositeCompartmentEditPartCN) {
+ IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((ExecutionEnvironmentCompositeCompartmentEditPartCN) childEditPart).getFigure());
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof NestedExecutionEnvironmentNameEditPartCN) {
+ return true;
+ }
+ if (childEditPart instanceof ExecutionEnvironmentCompositeCompartmentEditPartCN) {
+ IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
+ pane.remove(((ExecutionEnvironmentCompositeCompartmentEditPartCN) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ if (editPart instanceof ExecutionEnvironmentCompositeCompartmentEditPartCN) {
+ return getPrimaryShape().getCompositeCompartmentFigure();
+ }
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodePlate() {
+ RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 100);
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodeFigure() {
+ return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane.
+ * Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ @Override
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ super.setLineWidth(width);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(int style) {
+ if (primaryShape instanceof IPapyrusNodeFigure) {
+ ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(NestedExecutionEnvironmentNameEditPartCN.VISUAL_ID));
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedExecutionEnvironmentNameEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedExecutionEnvironmentNameEditPartCN.java
index 6cc959237be..4d66b52b3bc 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedExecutionEnvironmentNameEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedExecutionEnvironmentNameEditPartCN.java
@@ -1,871 +1,856 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 47;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public NestedExecutionEnvironmentNameEditPartCN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.ExecutionEnvironment_46, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedExecutionEnvironmentNameEditPartCN.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class NestedExecutionEnvironmentNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 47;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public NestedExecutionEnvironmentNameEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.ExecutionEnvironment_46, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedExecutionEnvironmentNameEditPartCN.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedNodeEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedNodeEditPartCN.java
index e39c39b5f59..86fe71668a2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedNodeEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedNodeEditPartCN.java
@@ -1,292 +1,296 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-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.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.NodeFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.NestedNodeItemSemanticEditPolicyCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class NestedNodeEditPartCN extends NodeEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 42;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public NestedNodeEditPartCN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new NestedNodeItemSemanticEditPolicyCN());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
- installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
- installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
- // 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() {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createNodeShape() {
- return primaryShape = new NodeFigure();
- }
-
- /**
- * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.NodeFigure
- *
- * @generated
- */
- @Override
- public NodeFigure getPrimaryShape() {
- return (NodeFigure) primaryShape;
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof NestedNodeNameEditPart) {
- ((NestedNodeNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
- return true;
- }
-
-
- if (childEditPart instanceof NodeCompositeCompartmentEditPartCN) {
- IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
- setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
- pane.add(((NodeCompositeCompartmentEditPartCN) childEditPart).getFigure());
- return true;
- }
-
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof NestedNodeNameEditPart) {
- return true;
- }
- if (childEditPart instanceof NodeCompositeCompartmentEditPartCN) {
- IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
- pane.remove(((NodeCompositeCompartmentEditPartCN) childEditPart).getFigure());
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- if (editPart instanceof NodeCompositeCompartmentEditPartCN) {
- return getPrimaryShape().getCompositeCompartmentFigure();
- }
- return getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodePlate() {
- RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 150);
- return result;
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodeFigure() {
- return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
-
- }
-
- /**
- * Default implementation treats passed figure as content pane.
- * Respects layout one may have set for generated figure.
- *
- * @param nodeShape
- * instance of generated figure class
- * @generated
- */
- @Override
- protected IFigure setupContentPane(IFigure nodeShape) {
- if (nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- @Override
- public IFigure getContentPane() {
- if (contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineWidth(int width) {
- super.setLineWidth(width);
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineType(int style) {
- if (primaryShape instanceof IPapyrusNodeFigure) {
- ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- @Override
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(NestedNodeNameEditPart.VISUAL_ID));
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+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.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.NodeFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class NestedNodeEditPartCN extends NodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 42;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public NestedNodeEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
+ installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
+ installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ // 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() {
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return primaryShape = new NodeFigure();
+ }
+
+ /**
+ * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.NodeFigure
+ *
+ * @generated
+ */
+ @Override
+ public NodeFigure getPrimaryShape() {
+ return (NodeFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof NestedNodeNameEditPart) {
+ ((NestedNodeNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+
+
+ if (childEditPart instanceof NodeCompositeCompartmentEditPartCN) {
+ IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((NodeCompositeCompartmentEditPartCN) childEditPart).getFigure());
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof NestedNodeNameEditPart) {
+ return true;
+ }
+ if (childEditPart instanceof NodeCompositeCompartmentEditPartCN) {
+ IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
+ pane.remove(((NodeCompositeCompartmentEditPartCN) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ if (editPart instanceof NodeCompositeCompartmentEditPartCN) {
+ return getPrimaryShape().getCompositeCompartmentFigure();
+ }
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodePlate() {
+ RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 150);
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodeFigure() {
+ return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane.
+ * Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ @Override
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ super.setLineWidth(width);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(int style) {
+ if (primaryShape instanceof IPapyrusNodeFigure) {
+ ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(NestedNodeNameEditPart.VISUAL_ID));
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedNodeNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedNodeNameEditPart.java
index 32e928d958f..96651b4eac9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedNodeNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NestedNodeNameEditPart.java
@@ -1,871 +1,856 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 43;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public NestedNodeNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Node_42, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedNodeNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class NestedNodeNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 43;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public NestedNodeNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Node_42, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedNodeNameEditPart.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeCompositeCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeCompositeCompartmentEditPart.java
index 9d0feb8b630..d9145e3717f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeCompositeCompartmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeCompositeCompartmentEditPart.java
@@ -25,11 +25,11 @@ import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
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.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.NodeCompositeCompartmentItemSemanticEditPolicy;
import org.eclipse.papyrus.uml.diagram.deployment.part.Messages;
/**
@@ -63,12 +63,12 @@ public class NodeCompositeCompartmentEditPart extends ShapeCompartmentEditPart {
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new NodeCompositeCompartmentItemSemanticEditPolicy());
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.NodeCompositeCompartmentCanonicalEditPolicy());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.NodeCompositeCompartmentCanonicalEditPolicy());
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeCompositeCompartmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeCompositeCompartmentEditPartCN.java
index 4eac96a1fb5..2940a6f83da 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeCompositeCompartmentEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeCompositeCompartmentEditPartCN.java
@@ -26,11 +26,11 @@ import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditP
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.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.NodeCompositeCompartmentItemSemanticEditPolicyCN;
import org.eclipse.papyrus.uml.diagram.deployment.part.Messages;
/**
@@ -65,12 +65,12 @@ public class NodeCompositeCompartmentEditPartCN extends ShapeCompartmentEditPart
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new NodeCompositeCompartmentItemSemanticEditPolicyCN());
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.NodeCompositeCompartmentCanonicalEditPolicyCN());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.NodeCompositeCompartmentCanonicalEditPolicyCN());
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeEditPart.java
index 3801bec7337..44ba1d486d7 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeEditPart.java
@@ -1,304 +1,308 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.common.notify.Notification;
-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.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
-import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.NodeFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.NodeItemSemanticEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class NodeEditPart extends NamedElementEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 2008;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public NodeEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new NodeItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
- installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
- installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
- // 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() {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- @Override
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createNodeShape() {
- return primaryShape = new NodeFigure();
- }
-
- /**
- * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.NodeFigure
- *
- * @generated
- */
- @Override
- public NodeFigure getPrimaryShape() {
- return (NodeFigure) primaryShape;
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof NodeNameEditPart) {
- ((NodeNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
- return true;
- }
-
-
- if (childEditPart instanceof NodeCompositeCompartmentEditPart) {
- IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
- setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
- pane.add(((NodeCompositeCompartmentEditPart) childEditPart).getFigure());
- return true;
- }
-
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof NodeNameEditPart) {
- return true;
- }
- if (childEditPart instanceof NodeCompositeCompartmentEditPart) {
- IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
- pane.remove(((NodeCompositeCompartmentEditPart) childEditPart).getFigure());
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- if (editPart instanceof NodeCompositeCompartmentEditPart) {
- return getPrimaryShape().getCompositeCompartmentFigure();
- }
- return getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodePlate() {
- RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 150);
- return result;
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodeFigure() {
- return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
-
- }
-
- /**
- * Default implementation treats passed figure as content pane.
- * Respects layout one may have set for generated figure.
- *
- * @param nodeShape
- * instance of generated figure class
- * @generated
- */
- @Override
- protected IFigure setupContentPane(IFigure nodeShape) {
- if (nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- @Override
- public IFigure getContentPane() {
- if (contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineWidth(int width) {
- super.setLineWidth(width);
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineType(int style) {
- if (primaryShape instanceof IPapyrusNodeFigure) {
- ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- @Override
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(NodeNameEditPart.VISUAL_ID));
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+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.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.NodeFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class NodeEditPart extends NamedElementEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2008;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public NodeEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
+ installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
+ installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ // 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() {
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return primaryShape = new NodeFigure();
+ }
+
+ /**
+ * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.NodeFigure
+ *
+ * @generated
+ */
+ @Override
+ public NodeFigure getPrimaryShape() {
+ return (NodeFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof NodeNameEditPart) {
+ ((NodeNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+
+
+ if (childEditPart instanceof NodeCompositeCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((NodeCompositeCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof NodeNameEditPart) {
+ return true;
+ }
+ if (childEditPart instanceof NodeCompositeCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
+ pane.remove(((NodeCompositeCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ if (editPart instanceof NodeCompositeCompartmentEditPart) {
+ return getPrimaryShape().getCompositeCompartmentFigure();
+ }
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodePlate() {
+ RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 150);
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodeFigure() {
+ return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane.
+ * Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ @Override
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ super.setLineWidth(width);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(int style) {
+ if (primaryShape instanceof IPapyrusNodeFigure) {
+ ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(NodeNameEditPart.VISUAL_ID));
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeEditPartCN.java
index 774e6a022df..aad088bb1cd 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeEditPartCN.java
@@ -1,289 +1,293 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.common.notify.Notification;
-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.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
-import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.NodeFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.NodeItemSemanticEditPolicyCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class NodeEditPartCN extends NamedElementEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 23;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public NodeEditPartCN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new NodeItemSemanticEditPolicyCN());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
- installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
- installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
- installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
- // 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() {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- @Override
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createNodeShape() {
- return primaryShape = new NodeFigure();
- }
-
- /**
- * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.NodeFigure
- *
- * @generated
- */
- @Override
- public NodeFigure getPrimaryShape() {
- return (NodeFigure) primaryShape;
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof NodeNameEditPartCN) {
- ((NodeNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
- return true;
- }
-
-
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof NodeNameEditPartCN) {
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- return getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodePlate() {
- RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 150);
- return result;
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodeFigure() {
- return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
-
- }
-
- /**
- * Default implementation treats passed figure as content pane.
- * Respects layout one may have set for generated figure.
- *
- * @param nodeShape
- * instance of generated figure class
- * @generated
- */
- @Override
- protected IFigure setupContentPane(IFigure nodeShape) {
- if (nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- @Override
- public IFigure getContentPane() {
- if (contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineWidth(int width) {
- super.setLineWidth(width);
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineType(int style) {
- if (primaryShape instanceof IPapyrusNodeFigure) {
- ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- @Override
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(NodeNameEditPartCN.VISUAL_ID));
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+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.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.NodeFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class NodeEditPartCN extends NamedElementEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 23;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public NodeEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
+ installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
+ installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ // 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() {
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return primaryShape = new NodeFigure();
+ }
+
+ /**
+ * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.NodeFigure
+ *
+ * @generated
+ */
+ @Override
+ public NodeFigure getPrimaryShape() {
+ return (NodeFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof NodeNameEditPartCN) {
+ ((NodeNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof NodeNameEditPartCN) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodePlate() {
+ RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 150);
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodeFigure() {
+ return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane.
+ * Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ @Override
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ super.setLineWidth(width);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(int style) {
+ if (primaryShape instanceof IPapyrusNodeFigure) {
+ ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(NodeNameEditPartCN.VISUAL_ID));
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeNameEditPart.java
index e8d2fa79001..61894200a6b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeNameEditPart.java
@@ -1,871 +1,856 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 9;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public NodeNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Node_2008, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class NodeNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 9;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public NodeNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Node_2008, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeNameEditPart.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeNameEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeNameEditPartCN.java
index 0f90a742615..5bc6411689a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeNameEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/NodeNameEditPartCN.java
@@ -1,871 +1,856 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 24;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public NodeNameEditPartCN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Node_23, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeNameEditPartCN.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(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);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class NodeNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 24;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public NodeNameEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Node_23, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeNameEditPartCN.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(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);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageEditPart.java
index a088bf2312d..da6664e82aa 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageEditPart.java
@@ -1,298 +1,302 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.common.notify.Notification;
-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.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.PackageItemSemanticEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.editparts.PackageEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 2009;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public PackageEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PackageItemSemanticEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
- installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
- // 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() {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- @Override
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createNodeShape() {
- return primaryShape = new PackageFigure();
- }
-
- /**
- * org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure
- *
- * @generated
- */
- @Override
- public PackageFigure getPrimaryShape() {
- return (PackageFigure) primaryShape;
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof PackageNameEditPart) {
- ((PackageNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
- return true;
- }
-
-
- if (childEditPart instanceof PackagePackageableElementCompartmentEditPart) {
- IFigure pane = getPrimaryShape().getPackageableElementFigure();
- setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
- pane.add(((PackagePackageableElementCompartmentEditPart) childEditPart).getFigure());
- return true;
- }
-
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof PackageNameEditPart) {
- return true;
- }
- if (childEditPart instanceof PackagePackageableElementCompartmentEditPart) {
- IFigure pane = getPrimaryShape().getPackageableElementFigure();
- pane.remove(((PackagePackageableElementCompartmentEditPart) childEditPart).getFigure());
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- if (editPart instanceof PackagePackageableElementCompartmentEditPart) {
- return getPrimaryShape().getPackageableElementFigure();
- }
- return getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected NodeFigure createNodePlate() {
- RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 150);
- return result;
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected NodeFigure createNodeFigure() {
- return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
-
- }
-
- /**
- * Default implementation treats passed figure as content pane.
- * Respects layout one may have set for generated figure.
- *
- * @param nodeShape
- * instance of generated figure class
- * @generated
- */
- @Override
- protected IFigure setupContentPane(IFigure nodeShape) {
- if (nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- @Override
- public IFigure getContentPane() {
- if (contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineWidth(int width) {
- super.setLineWidth(width);
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineType(int style) {
- if (primaryShape instanceof IPapyrusNodeFigure) {
- ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- @Override
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(PackageNameEditPart.VISUAL_ID));
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+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.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.editparts.PackageEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2009;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public PackageEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ // 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() {
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return primaryShape = new PackageFigure();
+ }
+
+ /**
+ * org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure
+ *
+ * @generated
+ */
+ @Override
+ public PackageFigure getPrimaryShape() {
+ return (PackageFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof PackageNameEditPart) {
+ ((PackageNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+
+
+ if (childEditPart instanceof PackagePackageableElementCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getPackageableElementFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((PackagePackageableElementCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof PackageNameEditPart) {
+ return true;
+ }
+ if (childEditPart instanceof PackagePackageableElementCompartmentEditPart) {
+ IFigure pane = getPrimaryShape().getPackageableElementFigure();
+ pane.remove(((PackagePackageableElementCompartmentEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ if (editPart instanceof PackagePackageableElementCompartmentEditPart) {
+ return getPrimaryShape().getPackageableElementFigure();
+ }
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodePlate() {
+ RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 150);
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodeFigure() {
+ return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane.
+ * Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ @Override
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ super.setLineWidth(width);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(int style) {
+ if (primaryShape instanceof IPapyrusNodeFigure) {
+ ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(PackageNameEditPart.VISUAL_ID));
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageEditPartCN.java
index e40687de6f6..555833d82af 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageEditPartCN.java
@@ -1,299 +1,303 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.common.notify.Notification;
-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.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
-import org.eclipse.papyrus.uml.diagram.common.editparts.PackageEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.PackageItemSemanticEditPolicyCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @generated
- */
-public class PackageEditPartCN extends PackageEditPart {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 36;
-
- /**
- * @generated
- */
- protected IFigure contentPane;
-
- /**
- * @generated
- */
- protected IFigure primaryShape;
-
- /**
- * @generated
- */
- public PackageEditPartCN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PackageItemSemanticEditPolicyCN());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
- installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
- installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
- // 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() {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * Papyrus codeGen
- *
- * @generated
- **/
- @Override
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
-
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createNodeShape() {
- return primaryShape = new PackageFigure();
- }
-
- /**
- * org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure
- *
- * @generated
- */
- @Override
- public PackageFigure getPrimaryShape() {
- return (PackageFigure) primaryShape;
- }
-
- /**
- * @generated
- */
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof PackageNameEditPartCN) {
- ((PackageNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
- return true;
- }
-
-
- if (childEditPart instanceof PackagePackageableElementCompartmentEditPartCN) {
- IFigure pane = getPrimaryShape().getPackageableElementFigure();
- setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
- pane.add(((PackagePackageableElementCompartmentEditPartCN) childEditPart).getFigure());
- return true;
- }
-
- return false;
- }
-
- /**
- * @generated
- */
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof PackageNameEditPartCN) {
- return true;
- }
- if (childEditPart instanceof PackagePackageableElementCompartmentEditPartCN) {
- IFigure pane = getPrimaryShape().getPackageableElementFigure();
- pane.remove(((PackagePackageableElementCompartmentEditPartCN) childEditPart).getFigure());
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- if (editPart instanceof PackagePackageableElementCompartmentEditPartCN) {
- return getPrimaryShape().getPackageableElementFigure();
- }
- return getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected NodeFigure createNodePlate() {
- RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 150);
- return result;
- }
-
- /**
- * Creates figure for this edit part.
- *
- * Body of this method does not depend on settings in generation model
- * so you may safely remove <i>generated</i> tag and modify it.
- *
- * @generated
- */
- @Override
- protected NodeFigure createNodeFigure() {
- return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
-
- }
-
- /**
- * Default implementation treats passed figure as content pane.
- * Respects layout one may have set for generated figure.
- *
- * @param nodeShape
- * instance of generated figure class
- * @generated
- */
- @Override
- protected IFigure setupContentPane(IFigure nodeShape) {
- if (nodeShape.getLayoutManager() == null) {
- ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
- layout.setSpacing(5);
- nodeShape.setLayoutManager(layout);
- }
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * @generated
- */
- @Override
- public IFigure getContentPane() {
- if (contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-
- /**
- * @generated
- */
- @Override
- protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineWidth(int width) {
- super.setLineWidth(width);
- }
-
- /**
- * @generated
- */
- @Override
- protected void setLineType(int style) {
- if (primaryShape instanceof IPapyrusNodeFigure) {
- ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
- }
- }
-
- /**
- * @generated
- */
- @Override
- public EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(UMLVisualIDRegistry.getType(PackageNameEditPartCN.VISUAL_ID));
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+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.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure;
+import org.eclipse.papyrus.uml.diagram.common.editparts.PackageEditPart;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ConstrainedItemBorderLayoutEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class PackageEditPartCN extends PackageEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 36;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public PackageEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
+
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
+ installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
+ // 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() {
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ @Override
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ @Override
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * Papyrus codeGen
+ *
+ * @generated
+ **/
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ super.handleNotificationEvent(event);
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createNodeShape() {
+ return primaryShape = new PackageFigure();
+ }
+
+ /**
+ * org.eclipse.papyrus.uml.diagram.common.figure.node.PackageFigure
+ *
+ * @generated
+ */
+ @Override
+ public PackageFigure getPrimaryShape() {
+ return (PackageFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof PackageNameEditPartCN) {
+ ((PackageNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+
+
+ if (childEditPart instanceof PackagePackageableElementCompartmentEditPartCN) {
+ IFigure pane = getPrimaryShape().getPackageableElementFigure();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((PackagePackageableElementCompartmentEditPartCN) childEditPart).getFigure());
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof PackageNameEditPartCN) {
+ return true;
+ }
+ if (childEditPart instanceof PackagePackageableElementCompartmentEditPartCN) {
+ IFigure pane = getPrimaryShape().getPackageableElementFigure();
+ pane.remove(((PackagePackageableElementCompartmentEditPartCN) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ if (editPart instanceof PackagePackageableElementCompartmentEditPartCN) {
+ return getPrimaryShape().getPackageableElementFigure();
+ }
+ return getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodePlate() {
+ RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 150);
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model
+ * so you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ @Override
+ protected NodeFigure createNodeFigure() {
+ return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane.
+ * Respects layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ @Override
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(5);
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineWidth(int width) {
+ super.setLineWidth(width);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setLineType(int style) {
+ if (primaryShape instanceof IPapyrusNodeFigure) {
+ ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLVisualIDRegistry.getType(PackageNameEditPartCN.VISUAL_ID));
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageNameEditPart.java
index 55b5972c5f2..b92c345fffc 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageNameEditPart.java
@@ -1,888 +1,873 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
-import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class PackageNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 35;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public PackageNameEditPart(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- EObject parserElement = getParserElement();
- if (parserElement == null) {
- return null;
- }
- List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
- for (View view : views) {
- if (AppearanceHelper.showElementIcon(view)) {
- return UMLElementTypes.getImage(parserElement.eClass());
- }
- }
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Package_2009, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageNameEditPart.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(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();
- }
- }
- }
- if (event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation) event.getNewValue()).getSource())) {
- refreshLabel();
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.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.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
+import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class PackageNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 35;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public PackageNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
+ for (View view : views) {
+ if (AppearanceHelper.showElementIcon(view)) {
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Package_2009, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageNameEditPart.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(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();
+ }
+ }
+ }
+ if (event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation) event.getNewValue()).getSource())) {
+ refreshLabel();
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageNameEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageNameEditPartCN.java
index ba411a82b87..42f83e13b87 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageNameEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageNameEditPartCN.java
@@ -1,888 +1,873 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
-import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-/**
- * @generated
- */
-public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 37;
-
- /**
- * @generated
- */
- private DirectEditManager manager;
-
- /**
- * @generated
- */
- private IParser parser;
-
- /**
- * @generated
- */
- private List<?> parserElements;
-
- /**
- * @generated
- */
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- * @generated
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- /**
- * configuration from a registered edit dialog
- *
- * @generated
- */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * @generated
- */
- public PackageNameEditPartCN(View view) {
- super(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
- }
-
- /**
- * @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 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 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 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 setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * @generated
- */
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- /**
- * @generated
- */
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- /**
- * @generated
- */
- protected Image getLabelIcon() {
- EObject parserElement = getParserElement();
- if (parserElement == null) {
- return null;
- }
- List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
- for (View view : views) {
- if (AppearanceHelper.showElementIcon(view)) {
- return UMLElementTypes.getImage(parserElement.eClass());
- }
- }
- return null;
- }
-
- /**
- * @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
- */
- @Override
- 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
- */
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- /**
- * @generated
- */
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- /**
- * @generated
- */
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- 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<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- /**
- * @generated
- */
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- /**
- * @generated
- */
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- /**
- * @generated
- */
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = UMLParserProvider.getParser(UMLElementTypes.Package_36, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageNameEditPartCN.VISUAL_ID));
- }
- return parser;
- }
-
- /**
- * @generated
- */
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- /**
- * @generated
- */
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- /**
- * @generated
- */
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- /**
- * @generated
- */
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this,
- MultilineLabelDirectEditManager.getTextCellEditorClass(this),
- UMLEditPartFactory.getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else 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(), configuration.getTextToEdit(resolveSemanticElement()),
- 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:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- /**
- * @generated
- */
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- /**
- * @generated
- */
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- 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 refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- /**
- * @generated
- */
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- /**
- * @generated
- */
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- * @generated
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- * @generated
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- * @generated
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- * @generated
- */
- protected void initExtendedEditorConfiguration() {
- if (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());
- }
- }
- }
-
- /**
- * 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.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- * @generated
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- 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
- */
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- @Override
- protected void handleNotificationEvent(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();
- }
- }
- }
- if (event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation) event.getNewValue()).getSource())) {
- refreshLabel();
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @generated
- */
- @Override
- protected IFigure createFigure() {
- // Parent should assign one using setLabel() method
- return null;
- }
-
- /**
- * @generated
- */
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- /**
- * @generated
- */
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- /**
- * @generated
- */
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- /**
- * @generated
- */
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- /**
- * @generated
- */
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.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.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
+import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+/**
+ * @generated
+ */
+public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 37;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List<?> parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * direct edition mode (default, undefined, registered editor, etc.)
+ *
+ * @generated
+ */
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ /**
+ * configuration from a registered edit dialog
+ *
+ * @generated
+ */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * @generated
+ */
+ public PackageNameEditPartCN(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
+ }
+
+ /**
+ * @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 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 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 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 setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setParser(IParser parser) {
+ this.parser = parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
+ for (View view : views) {
+ if (AppearanceHelper.showElementIcon(view)) {
+ return UMLElementTypes.getImage(parserElement.eClass());
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ @Override
+ 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<java.lang.Object>() {
+
+ @Override
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IParser getParser() {
+ if (parser == null) {
+ parser = UMLParserProvider.getParser(UMLElementTypes.Package_36, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageNameEditPartCN.VISUAL_ID));
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ getManager().show();
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+ // Create default edit manager
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
+ initializeDirectEditManager(theRequest);
+ return;
+ } else 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(), configuration.getTextToEdit(resolveSemanticElement()), 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:
+ initializeDirectEditManager(theRequest);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeDirectEditManager(final Request request) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+ @Override
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (request.getExtendedData().get(
+ RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ 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 refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if (resolveSemanticElement() instanceof Feature) {
+ if (((Feature) resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel) getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel) getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * Returns the kind of associated editor for direct edition.
+ *
+ * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
+ * @generated
+ */
+ public int getDirectEditionType() {
+ if (checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if (checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ /**
+ * Checks if an extended editor is present.
+ *
+ * @return <code>true</code> if an extended editor is present.
+ * @generated
+ */
+ protected boolean checkExtendedEditor() {
+ if (resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a default direct edition is available
+ *
+ * @return <code>true</code> if a default direct edition is available
+ * @generated
+ */
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ /**
+ * Initializes the extended editor configuration
+ *
+ * @generated
+ */
+ protected void initExtendedEditorConfiguration() {
+ if (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(), this);
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this);
+ }
+ }
+ }
+
+ /**
+ * 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.equals(configuration.getLanguage())) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this);
+ } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ /**
+ * Performs the direct edit usually used by GMF editors.
+ *
+ * @param theRequest
+ * the direct edit request that starts the direct edit system
+ * @generated
+ */
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ @Override
+ 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
+ */
+ @Override
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void handleNotificationEvent(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();
+ }
+ }
+ }
+ if (event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation) event.getNewValue()).getSource())) {
+ refreshLabel();
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private static final String ADD_PARENT_MODEL = "AddParentModel";
+
+ /**
+ * @generated
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ addOwnerElementListeners();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addOwnerElementListeners() {
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void deactivate() {
+ removeOwnerElementListeners();
+ super.deactivate();
+
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeOwnerElementListeners() {
+ removeListenerFilter(ADD_PARENT_MODEL);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackagePackageableElementCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackagePackageableElementCompartmentEditPart.java
index aade489e1e4..e6515d99189 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackagePackageableElementCompartmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackagePackageableElementCompartmentEditPart.java
@@ -25,11 +25,11 @@ import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
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.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.PackagePackageableElementCompartmentItemSemanticEditPolicy;
import org.eclipse.papyrus.uml.diagram.deployment.part.Messages;
/**
@@ -63,12 +63,12 @@ public class PackagePackageableElementCompartmentEditPart extends ShapeCompartme
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PackagePackageableElementCompartmentItemSemanticEditPolicy());
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.PackagePackageableElementCompartmentCanonicalEditPolicy());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.PackagePackageableElementCompartmentCanonicalEditPolicy());
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackagePackageableElementCompartmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackagePackageableElementCompartmentEditPartCN.java
index 61d5cc0c65c..a313d446d76 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackagePackageableElementCompartmentEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackagePackageableElementCompartmentEditPartCN.java
@@ -25,11 +25,11 @@ import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
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.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.PackagePackageableElementCompartmentItemSemanticEditPolicyCN;
import org.eclipse.papyrus.uml.diagram.deployment.part.Messages;
/**
@@ -63,12 +63,12 @@ public class PackagePackageableElementCompartmentEditPartCN extends ShapeCompart
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PackagePackageableElementCompartmentItemSemanticEditPolicyCN());
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.PackagePackageableElementCompartmentCanonicalEditPolicyCN());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.deployment.edit.policies.PackagePackageableElementCompartmentCanonicalEditPolicyCN());
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/UMLEditPartFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/UMLEditPartFactory.java
index ffa7e7d20f8..2f5cedb7f59 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/UMLEditPartFactory.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/UMLEditPartFactory.java
@@ -1,359 +1,358 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
-
-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.notation.View;
-import org.eclipse.gmf.tooling.runtime.directedit.locator.CellEditorLocatorAccess;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * @generated
- */
-public class UMLEditPartFactory implements EditPartFactory {
-
- /**
- * @generated
- */
- @Override
- public EditPart createEditPart(EditPart context, Object model) {
- if (model instanceof View) {
- View view = (View) model;
- switch (UMLVisualIDRegistry.getVisualID(view)) {
-
- case DeploymentDiagramEditPart.VISUAL_ID:
- return new DeploymentDiagramEditPart(view);
-
- case DependencyNodeEditPart.VISUAL_ID:
- return new DependencyNodeEditPart(view);
-
- case MultiDependencyLabelEditPart.VISUAL_ID:
- return new MultiDependencyLabelEditPart(view);
-
- case ModelEditPart.VISUAL_ID:
- return new ModelEditPart(view);
-
- case ModelNameEditPart.VISUAL_ID:
- return new ModelNameEditPart(view);
-
- case PackageEditPart.VISUAL_ID:
- return new PackageEditPart(view);
-
- case PackageNameEditPart.VISUAL_ID:
- return new PackageNameEditPart(view);
-
- case ConstraintEditPart.VISUAL_ID:
- return new ConstraintEditPart(view);
-
- case ConstraintNameEditPart.VISUAL_ID:
- return new ConstraintNameEditPart(view);
-
- case ConstraintSpecificationEditPart.VISUAL_ID:
- return new ConstraintSpecificationEditPart(view);
-
- case CommentEditPart.VISUAL_ID:
- return new CommentEditPart(view);
-
- case CommentBodyEditPart.VISUAL_ID:
- return new CommentBodyEditPart(view);
-
- case ExecutionEnvironmentEditPart.VISUAL_ID:
- return new ExecutionEnvironmentEditPart(view);
-
- case ExecutionEnvironmentNameEditPart.VISUAL_ID:
- return new ExecutionEnvironmentNameEditPart(view);
-
- case DeviceEditPart.VISUAL_ID:
- return new DeviceEditPart(view);
-
- case DeviceNameEditPart.VISUAL_ID:
- return new DeviceNameEditPart(view);
-
- case ArtifactEditPart.VISUAL_ID:
- return new ArtifactEditPart(view);
-
- case ArtifactNameEditPart.VISUAL_ID:
- return new ArtifactNameEditPart(view);
-
- case ArtifactFloatingLabelEditPart.VISUAL_ID:
- return new ArtifactFloatingLabelEditPart(view);
-
- case NodeEditPart.VISUAL_ID:
- return new NodeEditPart(view);
-
- case NodeNameEditPart.VISUAL_ID:
- return new NodeNameEditPart(view);
-
- case DefaultNamedElementEditPart.VISUAL_ID:
- return new DefaultNamedElementEditPart(view);
-
- case DefaultNamedElementNameEditPart.VISUAL_ID:
- return new DefaultNamedElementNameEditPart(view);
-
- case ModelEditPartCN.VISUAL_ID:
- return new ModelEditPartCN(view);
-
- case ModelNameEditPartCN.VISUAL_ID:
- return new ModelNameEditPartCN(view);
-
- case PackageEditPartCN.VISUAL_ID:
- return new PackageEditPartCN(view);
-
- case PackageNameEditPartCN.VISUAL_ID:
- return new PackageNameEditPartCN(view);
-
- case DeviceEditPartCN.VISUAL_ID:
- return new DeviceEditPartCN(view);
-
- case DeviceNameEditPartCN.VISUAL_ID:
- return new DeviceNameEditPartCN(view);
-
- case NestedDeviceEditPartCN.VISUAL_ID:
- return new NestedDeviceEditPartCN(view);
-
- case NestedDeviceNameEditPartCN.VISUAL_ID:
- return new NestedDeviceNameEditPartCN(view);
-
- case ExecutionEnvironmentEditPartCN.VISUAL_ID:
- return new ExecutionEnvironmentEditPartCN(view);
-
- case ExecutionEnvironmentNameEditPartCN.VISUAL_ID:
- return new ExecutionEnvironmentNameEditPartCN(view);
-
- case NestedExecutionEnvironmentEditPartCN.VISUAL_ID:
- return new NestedExecutionEnvironmentEditPartCN(view);
-
- case NestedExecutionEnvironmentNameEditPartCN.VISUAL_ID:
- return new NestedExecutionEnvironmentNameEditPartCN(view);
-
- case NodeEditPartCN.VISUAL_ID:
- return new NodeEditPartCN(view);
-
- case NodeNameEditPartCN.VISUAL_ID:
- return new NodeNameEditPartCN(view);
-
- case NestedNodeEditPartCN.VISUAL_ID:
- return new NestedNodeEditPartCN(view);
-
- case NestedNodeNameEditPart.VISUAL_ID:
- return new NestedNodeNameEditPart(view);
-
- case ArtifactEditPartCN.VISUAL_ID:
- return new ArtifactEditPartCN(view);
-
- case ArtifactNameEditPartCN.VISUAL_ID:
- return new ArtifactNameEditPartCN(view);
-
- case ArtifactFloatingLabelEditPartCN.VISUAL_ID:
- return new ArtifactFloatingLabelEditPartCN(view);
-
- case ArtifactEditPartACN.VISUAL_ID:
- return new ArtifactEditPartACN(view);
-
- case ArtifactNameEditPartACN.VISUAL_ID:
- return new ArtifactNameEditPartACN(view);
-
- case ArtifactFloatingLabelEditPartACN.VISUAL_ID:
- return new ArtifactFloatingLabelEditPartACN(view);
-
- case NestedArtifactNodeEditPartCN.VISUAL_ID:
- return new NestedArtifactNodeEditPartCN(view);
-
- case NestedArtifactNameEditPart.VISUAL_ID:
- return new NestedArtifactNameEditPart(view);
-
- case CommentEditPartCN.VISUAL_ID:
- return new CommentEditPartCN(view);
-
- case CommentBodyEditPartCN.VISUAL_ID:
- return new CommentBodyEditPartCN(view);
-
- case ConstraintEditPartCN.VISUAL_ID:
- return new ConstraintEditPartCN(view);
-
- case ConstraintNameEditPartCN.VISUAL_ID:
- return new ConstraintNameEditPartCN(view);
-
- case ConstraintSpecificationEditPartCN.VISUAL_ID:
- return new ConstraintSpecificationEditPartCN(view);
-
- case ModelPackageableElementCompartmentEditPart.VISUAL_ID:
- return new ModelPackageableElementCompartmentEditPart(view);
-
- case PackagePackageableElementCompartmentEditPart.VISUAL_ID:
- return new PackagePackageableElementCompartmentEditPart(view);
-
- case DeviceCompositeCompartmentEditPart.VISUAL_ID:
- return new DeviceCompositeCompartmentEditPart(view);
-
- case ExecutionEnvironmentCompositeCompartmentEditPart.VISUAL_ID:
- return new ExecutionEnvironmentCompositeCompartmentEditPart(view);
-
- case NodeCompositeCompartmentEditPart.VISUAL_ID:
- return new NodeCompositeCompartmentEditPart(view);
-
- case ArtifactCompositeCompartmentEditPart.VISUAL_ID:
- return new ArtifactCompositeCompartmentEditPart(view);
-
- case ModelPackageableElementCompartmentEditPartCN.VISUAL_ID:
- return new ModelPackageableElementCompartmentEditPartCN(view);
-
- case PackagePackageableElementCompartmentEditPartCN.VISUAL_ID:
- return new PackagePackageableElementCompartmentEditPartCN(view);
-
- case DeviceCompositeCompartmentEditPartCN.VISUAL_ID:
- return new DeviceCompositeCompartmentEditPartCN(view);
-
- case ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID:
- return new ExecutionEnvironmentCompositeCompartmentEditPartCN(view);
-
- case NodeCompositeCompartmentEditPartCN.VISUAL_ID:
- return new NodeCompositeCompartmentEditPartCN(view);
-
- case ArtifactCompositeCompartmentEditPartCN.VISUAL_ID:
- return new ArtifactCompositeCompartmentEditPartCN(view);
-
- case ArtifactCompositeCompartmentEditPartACN.VISUAL_ID:
- return new ArtifactCompositeCompartmentEditPartACN(view);
-
- case LinkDescriptorEditPart.VISUAL_ID:
- return new LinkDescriptorEditPart(view);
-
-
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return new CommentAnnotatedElementEditPart(view);
-
-
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return new ConstraintConstrainedElementEditPart(view);
-
-
- case DeploymentEditPart.VISUAL_ID:
- return new DeploymentEditPart(view);
-
- case DeploymentNameEditPart.VISUAL_ID:
- return new DeploymentNameEditPart(view);
-
- case DeploymentAppliedStereotypeEditPart.VISUAL_ID:
- return new DeploymentAppliedStereotypeEditPart(view);
-
-
- case ManifestationEditPart.VISUAL_ID:
- return new ManifestationEditPart(view);
-
- case ManifestationNameEditPart.VISUAL_ID:
- return new ManifestationNameEditPart(view);
-
- case ManifestationAppliedStereotypeEditPart.VISUAL_ID:
- return new ManifestationAppliedStereotypeEditPart(view);
-
-
- case GeneralizationEditPart.VISUAL_ID:
- return new GeneralizationEditPart(view);
-
- case GeneralizationAppliedStereotypeEditPart.VISUAL_ID:
- return new GeneralizationAppliedStereotypeEditPart(view);
-
-
- case DependencyEditPart.VISUAL_ID:
- return new DependencyEditPart(view);
-
- case DependencyNameEditPart.VISUAL_ID:
- return new DependencyNameEditPart(view);
-
- case DependencyAppliedStereotypeEditPart.VISUAL_ID:
- return new DependencyAppliedStereotypeEditPart(view);
-
-
- case DependencyBranchEditPart.VISUAL_ID:
- return new DependencyBranchEditPart(view);
-
- }
- }
- return createUnrecognizedEditPart(context, model);
- }
-
- /**
- * @generated
- */
- private EditPart createUnrecognizedEditPart(EditPart context, Object model) {
- // Handle creation of unrecognized child node EditParts here
- return null;
- }
-
- /**
- * @generated
- */
- public static CellEditorLocator getTextCellEditorLocator(ITextAwareEditPart source) {
- if (source.getFigure() instanceof IMultilineEditableFigure) {
- return new MultilineCellEditorLocator(
- (IMultilineEditableFigure) source.getFigure());
- }
- else {
- return CellEditorLocatorAccess.INSTANCE.getTextCellEditorLocator(source);
-
- }
- }
-
- /**
- * @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
- */
- @Override
- 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);
- }
- }
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.parts;
+
+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.notation.View;
+import org.eclipse.gmf.tooling.runtime.directedit.locator.CellEditorLocatorAccess;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @generated
+ */
+public class UMLEditPartFactory implements EditPartFactory {
+
+ /**
+ * @generated
+ */
+ @Override
+ public EditPart createEditPart(EditPart context, Object model) {
+ if (model instanceof View) {
+ View view = (View) model;
+ switch (UMLVisualIDRegistry.getVisualID(view)) {
+
+ case DeploymentDiagramEditPart.VISUAL_ID:
+ return new DeploymentDiagramEditPart(view);
+
+ case DependencyNodeEditPart.VISUAL_ID:
+ return new DependencyNodeEditPart(view);
+
+ case MultiDependencyLabelEditPart.VISUAL_ID:
+ return new MultiDependencyLabelEditPart(view);
+
+ case ModelEditPart.VISUAL_ID:
+ return new ModelEditPart(view);
+
+ case ModelNameEditPart.VISUAL_ID:
+ return new ModelNameEditPart(view);
+
+ case PackageEditPart.VISUAL_ID:
+ return new PackageEditPart(view);
+
+ case PackageNameEditPart.VISUAL_ID:
+ return new PackageNameEditPart(view);
+
+ case ConstraintEditPart.VISUAL_ID:
+ return new ConstraintEditPart(view);
+
+ case ConstraintNameEditPart.VISUAL_ID:
+ return new ConstraintNameEditPart(view);
+
+ case ConstraintSpecificationEditPart.VISUAL_ID:
+ return new ConstraintSpecificationEditPart(view);
+
+ case CommentEditPart.VISUAL_ID:
+ return new CommentEditPart(view);
+
+ case CommentBodyEditPart.VISUAL_ID:
+ return new CommentBodyEditPart(view);
+
+ case ExecutionEnvironmentEditPart.VISUAL_ID:
+ return new ExecutionEnvironmentEditPart(view);
+
+ case ExecutionEnvironmentNameEditPart.VISUAL_ID:
+ return new ExecutionEnvironmentNameEditPart(view);
+
+ case DeviceEditPart.VISUAL_ID:
+ return new DeviceEditPart(view);
+
+ case DeviceNameEditPart.VISUAL_ID:
+ return new DeviceNameEditPart(view);
+
+ case ArtifactEditPart.VISUAL_ID:
+ return new ArtifactEditPart(view);
+
+ case ArtifactNameEditPart.VISUAL_ID:
+ return new ArtifactNameEditPart(view);
+
+ case ArtifactFloatingLabelEditPart.VISUAL_ID:
+ return new ArtifactFloatingLabelEditPart(view);
+
+ case NodeEditPart.VISUAL_ID:
+ return new NodeEditPart(view);
+
+ case NodeNameEditPart.VISUAL_ID:
+ return new NodeNameEditPart(view);
+
+ case DefaultNamedElementEditPart.VISUAL_ID:
+ return new DefaultNamedElementEditPart(view);
+
+ case DefaultNamedElementNameEditPart.VISUAL_ID:
+ return new DefaultNamedElementNameEditPart(view);
+
+ case ModelEditPartCN.VISUAL_ID:
+ return new ModelEditPartCN(view);
+
+ case ModelNameEditPartCN.VISUAL_ID:
+ return new ModelNameEditPartCN(view);
+
+ case PackageEditPartCN.VISUAL_ID:
+ return new PackageEditPartCN(view);
+
+ case PackageNameEditPartCN.VISUAL_ID:
+ return new PackageNameEditPartCN(view);
+
+ case DeviceEditPartCN.VISUAL_ID:
+ return new DeviceEditPartCN(view);
+
+ case DeviceNameEditPartCN.VISUAL_ID:
+ return new DeviceNameEditPartCN(view);
+
+ case NestedDeviceEditPartCN.VISUAL_ID:
+ return new NestedDeviceEditPartCN(view);
+
+ case NestedDeviceNameEditPartCN.VISUAL_ID:
+ return new NestedDeviceNameEditPartCN(view);
+
+ case ExecutionEnvironmentEditPartCN.VISUAL_ID:
+ return new ExecutionEnvironmentEditPartCN(view);
+
+ case ExecutionEnvironmentNameEditPartCN.VISUAL_ID:
+ return new ExecutionEnvironmentNameEditPartCN(view);
+
+ case NestedExecutionEnvironmentEditPartCN.VISUAL_ID:
+ return new NestedExecutionEnvironmentEditPartCN(view);
+
+ case NestedExecutionEnvironmentNameEditPartCN.VISUAL_ID:
+ return new NestedExecutionEnvironmentNameEditPartCN(view);
+
+ case NodeEditPartCN.VISUAL_ID:
+ return new NodeEditPartCN(view);
+
+ case NodeNameEditPartCN.VISUAL_ID:
+ return new NodeNameEditPartCN(view);
+
+ case NestedNodeEditPartCN.VISUAL_ID:
+ return new NestedNodeEditPartCN(view);
+
+ case NestedNodeNameEditPart.VISUAL_ID:
+ return new NestedNodeNameEditPart(view);
+
+ case ArtifactEditPartCN.VISUAL_ID:
+ return new ArtifactEditPartCN(view);
+
+ case ArtifactNameEditPartCN.VISUAL_ID:
+ return new ArtifactNameEditPartCN(view);
+
+ case ArtifactFloatingLabelEditPartCN.VISUAL_ID:
+ return new ArtifactFloatingLabelEditPartCN(view);
+
+ case ArtifactEditPartACN.VISUAL_ID:
+ return new ArtifactEditPartACN(view);
+
+ case ArtifactNameEditPartACN.VISUAL_ID:
+ return new ArtifactNameEditPartACN(view);
+
+ case ArtifactFloatingLabelEditPartACN.VISUAL_ID:
+ return new ArtifactFloatingLabelEditPartACN(view);
+
+ case NestedArtifactNodeEditPartCN.VISUAL_ID:
+ return new NestedArtifactNodeEditPartCN(view);
+
+ case NestedArtifactNameEditPart.VISUAL_ID:
+ return new NestedArtifactNameEditPart(view);
+
+ case CommentEditPartCN.VISUAL_ID:
+ return new CommentEditPartCN(view);
+
+ case CommentBodyEditPartCN.VISUAL_ID:
+ return new CommentBodyEditPartCN(view);
+
+ case ConstraintEditPartCN.VISUAL_ID:
+ return new ConstraintEditPartCN(view);
+
+ case ConstraintNameEditPartCN.VISUAL_ID:
+ return new ConstraintNameEditPartCN(view);
+
+ case ConstraintSpecificationEditPartCN.VISUAL_ID:
+ return new ConstraintSpecificationEditPartCN(view);
+
+ case ModelPackageableElementCompartmentEditPart.VISUAL_ID:
+ return new ModelPackageableElementCompartmentEditPart(view);
+
+ case PackagePackageableElementCompartmentEditPart.VISUAL_ID:
+ return new PackagePackageableElementCompartmentEditPart(view);
+
+ case DeviceCompositeCompartmentEditPart.VISUAL_ID:
+ return new DeviceCompositeCompartmentEditPart(view);
+
+ case ExecutionEnvironmentCompositeCompartmentEditPart.VISUAL_ID:
+ return new ExecutionEnvironmentCompositeCompartmentEditPart(view);
+
+ case NodeCompositeCompartmentEditPart.VISUAL_ID:
+ return new NodeCompositeCompartmentEditPart(view);
+
+ case ArtifactCompositeCompartmentEditPart.VISUAL_ID:
+ return new ArtifactCompositeCompartmentEditPart(view);
+
+ case ModelPackageableElementCompartmentEditPartCN.VISUAL_ID:
+ return new ModelPackageableElementCompartmentEditPartCN(view);
+
+ case PackagePackageableElementCompartmentEditPartCN.VISUAL_ID:
+ return new PackagePackageableElementCompartmentEditPartCN(view);
+
+ case DeviceCompositeCompartmentEditPartCN.VISUAL_ID:
+ return new DeviceCompositeCompartmentEditPartCN(view);
+
+ case ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID:
+ return new ExecutionEnvironmentCompositeCompartmentEditPartCN(view);
+
+ case NodeCompositeCompartmentEditPartCN.VISUAL_ID:
+ return new NodeCompositeCompartmentEditPartCN(view);
+
+ case ArtifactCompositeCompartmentEditPartCN.VISUAL_ID:
+ return new ArtifactCompositeCompartmentEditPartCN(view);
+
+ case ArtifactCompositeCompartmentEditPartACN.VISUAL_ID:
+ return new ArtifactCompositeCompartmentEditPartACN(view);
+
+ case LinkDescriptorEditPart.VISUAL_ID:
+ return new LinkDescriptorEditPart(view);
+
+
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return new CommentAnnotatedElementEditPart(view);
+
+
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return new ConstraintConstrainedElementEditPart(view);
+
+
+ case DeploymentEditPart.VISUAL_ID:
+ return new DeploymentEditPart(view);
+
+ case DeploymentNameEditPart.VISUAL_ID:
+ return new DeploymentNameEditPart(view);
+
+ case DeploymentAppliedStereotypeEditPart.VISUAL_ID:
+ return new DeploymentAppliedStereotypeEditPart(view);
+
+
+ case ManifestationEditPart.VISUAL_ID:
+ return new ManifestationEditPart(view);
+
+ case ManifestationNameEditPart.VISUAL_ID:
+ return new ManifestationNameEditPart(view);
+
+ case ManifestationAppliedStereotypeEditPart.VISUAL_ID:
+ return new ManifestationAppliedStereotypeEditPart(view);
+
+
+ case GeneralizationEditPart.VISUAL_ID:
+ return new GeneralizationEditPart(view);
+
+ case GeneralizationAppliedStereotypeEditPart.VISUAL_ID:
+ return new GeneralizationAppliedStereotypeEditPart(view);
+
+
+ case DependencyEditPart.VISUAL_ID:
+ return new DependencyEditPart(view);
+
+ case DependencyNameEditPart.VISUAL_ID:
+ return new DependencyNameEditPart(view);
+
+ case DependencyAppliedStereotypeEditPart.VISUAL_ID:
+ return new DependencyAppliedStereotypeEditPart(view);
+
+
+ case DependencyBranchEditPart.VISUAL_ID:
+ return new DependencyBranchEditPart(view);
+
+ }
+ }
+ return createUnrecognizedEditPart(context, model);
+ }
+
+ /**
+ * @generated
+ */
+ private EditPart createUnrecognizedEditPart(EditPart context, Object model) {
+ // Handle creation of unrecognized child node EditParts here
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public static CellEditorLocator getTextCellEditorLocator(ITextAwareEditPart source) {
+ if (source.getFigure() instanceof IMultilineEditableFigure) {
+ return new MultilineCellEditorLocator(
+ (IMultilineEditableFigure) source.getFigure());
+ } else {
+ return CellEditorLocatorAccess.INSTANCE.getTextCellEditorLocator(source);
+
+ }
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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);
+ }
+ }
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentCanonicalEditPolicy.java
deleted file mode 100644
index 97fca2733a7..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentCanonicalEditPolicy.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-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.uml.diagram.deployment.edit.parts.ArtifactEditPartACN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramUpdater;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLNodeDescriptor;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ArtifactCompositeCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected EStructuralFeature getFeatureToSynchronize() {
- return UMLPackage.eINSTANCE.getArtifact_NestedArtifact();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<EObject> getSemanticChildrenList() {
- View viewObject = (View) getHost().getModel();
- LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
- .getArtifactArtifactCompositeCompartment_26SemanticChildren(viewObject);
- for (UMLNodeDescriptor d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- }
-
- /**
- * @generated
- */
- @Override
- protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) {
- return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement());
- }
-
- /**
- * @generated
- */
- private boolean isMyDiagramElement(View view) {
- return ArtifactEditPartACN.VISUAL_ID == UMLVisualIDRegistry.getVisualID(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshSemantic() {
- if (resolveSemanticElement() == null) {
- return;
- }
- LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors =
- UMLDiagramUpdater.INSTANCE
- .getArtifactArtifactCompositeCompartment_26SemanticChildren((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/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentCanonicalEditPolicyACN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentCanonicalEditPolicyACN.java
deleted file mode 100644
index 63b3a278c27..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentCanonicalEditPolicyACN.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-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.uml.diagram.deployment.edit.parts.ArtifactEditPartACN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramUpdater;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLNodeDescriptor;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ArtifactCompositeCompartmentCanonicalEditPolicyACN extends CanonicalEditPolicy {
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected EStructuralFeature getFeatureToSynchronize() {
- return UMLPackage.eINSTANCE.getArtifact_NestedArtifact();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<EObject> getSemanticChildrenList() {
- View viewObject = (View) getHost().getModel();
- LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
- .getArtifactArtifactCompositeCompartment_34SemanticChildren(viewObject);
- for (UMLNodeDescriptor d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- }
-
- /**
- * @generated
- */
- @Override
- protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) {
- return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement());
- }
-
- /**
- * @generated
- */
- private boolean isMyDiagramElement(View view) {
- return ArtifactEditPartACN.VISUAL_ID == UMLVisualIDRegistry.getVisualID(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshSemantic() {
- if (resolveSemanticElement() == null) {
- return;
- }
- LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors =
- UMLDiagramUpdater.INSTANCE
- .getArtifactArtifactCompositeCompartment_34SemanticChildren((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/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentCanonicalEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentCanonicalEditPolicyCN.java
deleted file mode 100644
index ca8255657ca..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentCanonicalEditPolicyCN.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-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.uml.diagram.deployment.edit.parts.ArtifactEditPartACN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramUpdater;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLNodeDescriptor;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ArtifactCompositeCompartmentCanonicalEditPolicyCN extends CanonicalEditPolicy {
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected EStructuralFeature getFeatureToSynchronize() {
- return UMLPackage.eINSTANCE.getArtifact_NestedArtifact();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<EObject> getSemanticChildrenList() {
- View viewObject = (View) getHost().getModel();
- LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
- .getArtifactArtifactCompositeCompartment_33SemanticChildren(viewObject);
- for (UMLNodeDescriptor d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- }
-
- /**
- * @generated
- */
- @Override
- protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) {
- return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement());
- }
-
- /**
- * @generated
- */
- private boolean isMyDiagramElement(View view) {
- return ArtifactEditPartACN.VISUAL_ID == UMLVisualIDRegistry.getVisualID(view);
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshSemantic() {
- if (resolveSemanticElement() == null) {
- return;
- }
- LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors =
- UMLDiagramUpdater.INSTANCE
- .getArtifactArtifactCompositeCompartment_33SemanticChildren((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/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentItemSemanticEditPolicy.java
deleted file mode 100644
index 615cdad94da..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ArtifactCreateCommandACN;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class ArtifactCompositeCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public ArtifactCompositeCompartmentItemSemanticEditPolicy() {
- super(UMLElementTypes.Artifact_2006);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateCommand(CreateElementRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return super.getCreateCommand(req);
- }
-
-
- if (UMLElementTypes.Artifact_28 == requestElementType) {
-
- return getGEFWrapper(new ArtifactCreateCommandACN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- return super.getCreateCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentItemSemanticEditPolicyACN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentItemSemanticEditPolicyACN.java
deleted file mode 100644
index 7e2482c3dc2..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentItemSemanticEditPolicyACN.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ArtifactCreateCommandACN;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class ArtifactCompositeCompartmentItemSemanticEditPolicyACN extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public ArtifactCompositeCompartmentItemSemanticEditPolicyACN() {
- super(UMLElementTypes.Artifact_28);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateCommand(CreateElementRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return super.getCreateCommand(req);
- }
-
-
- if (UMLElementTypes.Artifact_28 == requestElementType) {
-
- return getGEFWrapper(new ArtifactCreateCommandACN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- return super.getCreateCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentItemSemanticEditPolicyCN.java
deleted file mode 100644
index abf5f529515..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentItemSemanticEditPolicyCN.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ArtifactCreateCommandACN;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class ArtifactCompositeCompartmentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public ArtifactCompositeCompartmentItemSemanticEditPolicyCN() {
- super(UMLElementTypes.Artifact_25);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateCommand(CreateElementRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return super.getCreateCommand(req);
- }
-
-
- if (UMLElementTypes.Artifact_28 == requestElementType) {
-
- return getGEFWrapper(new ArtifactCreateCommandACN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- return super.getCreateCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactItemSemanticEditPolicy.java
deleted file mode 100644
index e39cffe4f24..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyBranchCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeploymentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.GeneralizationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ManifestationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class ArtifactItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public ArtifactItemSemanticEditPolicy() {
- super(UMLElementTypes.Artifact_2006);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- EObject selectedEObject = req.getElementToDestroy();
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
- if (provider != null) {
- // Retrieve delete command from the Element Edit service
- ICommand deleteCommand = provider.getEditCommand(req);
-
- if (deleteCommand != null) {
- return new ICommandProxy(deleteCommand);
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactItemSemanticEditPolicyACN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactItemSemanticEditPolicyACN.java
deleted file mode 100644
index 81dde53dffa..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactItemSemanticEditPolicyACN.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.emf.edit.command.DeleteCommand;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
-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.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand;
-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.ReorientReferenceRelationshipRequest;
-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.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyBranchCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeploymentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.GeneralizationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ManifestationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactCompositeCompartmentEditPartACN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPartACN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class ArtifactItemSemanticEditPolicyACN extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public ArtifactItemSemanticEditPolicyACN() {
- super(UMLElementTypes.Artifact_28);
- }
-
- /**
- * @generated
- */
- @Override
- 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 DeleteCommand(getEditingDomain(), todestroy)));
- } else {
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
- /**
- * @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 ArtifactCompositeCompartmentEditPartACN.VISUAL_ID:
- for (Iterator<?> cit = node.getChildren().iterator(); cit.hasNext();) {
- Node cnode = (Node) cit.next();
- switch (UMLVisualIDRegistry.getVisualID(cnode)) {
- case ArtifactEditPartACN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactItemSemanticEditPolicyCN.java
deleted file mode 100644
index 092b1cf5ed5..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactItemSemanticEditPolicyCN.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.emf.edit.command.DeleteCommand;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
-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.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand;
-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.ReorientReferenceRelationshipRequest;
-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.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyBranchCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeploymentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.GeneralizationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ManifestationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactCompositeCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPartACN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class ArtifactItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public ArtifactItemSemanticEditPolicyCN() {
- super(UMLElementTypes.Artifact_25);
- }
-
- /**
- * @generated
- */
- @Override
- 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 DeleteCommand(getEditingDomain(), todestroy)));
- } else {
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
- /**
- * @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 ArtifactCompositeCompartmentEditPartCN.VISUAL_ID:
- for (Iterator<?> cit = node.getChildren().iterator(); cit.hasNext();) {
- Node cnode = (Node) cit.next();
- switch (UMLVisualIDRegistry.getVisualID(cnode)) {
- case ArtifactEditPartACN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/CommentAnnotatedElementItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/CommentAnnotatedElementItemSemanticEditPolicy.java
deleted file mode 100644
index b62e3e18f96..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/CommentAnnotatedElementItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class CommentAnnotatedElementItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public CommentAnnotatedElementItemSemanticEditPolicy() {
- super(UMLElementTypes.CommentAnnotatedElement_4008);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
- return getGEFWrapper(new DestroyReferenceCommand(req));
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/CommentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/CommentItemSemanticEditPolicy.java
deleted file mode 100644
index 03b35f376ba..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/CommentItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class CommentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public CommentItemSemanticEditPolicy() {
- super(UMLElementTypes.Comment_2001);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- EObject selectedEObject = req.getElementToDestroy();
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
- if (provider != null) {
- // Retrieve delete command from the Element Edit service
- ICommand deleteCommand = provider.getEditCommand(req);
-
- if (deleteCommand != null) {
- return new ICommandProxy(deleteCommand);
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/CommentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/CommentItemSemanticEditPolicyCN.java
deleted file mode 100644
index 4786f21c4e6..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/CommentItemSemanticEditPolicyCN.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class CommentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public CommentItemSemanticEditPolicyCN() {
- super(UMLElementTypes.Comment_54);
- }
-
- /**
- * @generated
- */
- @Override
- 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());
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ConstraintConstrainedElementItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ConstraintConstrainedElementItemSemanticEditPolicy.java
deleted file mode 100644
index 7755e708c40..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ConstraintConstrainedElementItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class ConstraintConstrainedElementItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public ConstraintConstrainedElementItemSemanticEditPolicy() {
- super(UMLElementTypes.ConstraintConstrainedElement_4009);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
- return getGEFWrapper(new DestroyReferenceCommand(req));
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ConstraintItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ConstraintItemSemanticEditPolicy.java
deleted file mode 100644
index 4d7cda2a34a..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ConstraintItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyBranchCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeploymentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ManifestationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class ConstraintItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public ConstraintItemSemanticEditPolicy() {
- super(UMLElementTypes.Constraint_2005);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- EObject selectedEObject = req.getElementToDestroy();
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
- if (provider != null) {
- // Retrieve delete command from the Element Edit service
- ICommand deleteCommand = provider.getEditCommand(req);
-
- if (deleteCommand != null) {
- return new ICommandProxy(deleteCommand);
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ConstraintItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ConstraintItemSemanticEditPolicyCN.java
deleted file mode 100644
index d30c44d5f53..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ConstraintItemSemanticEditPolicyCN.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-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.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-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.notation.View;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyBranchCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeploymentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ManifestationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class ConstraintItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public ConstraintItemSemanticEditPolicyCN() {
- super(UMLElementTypes.Constraint_56);
- }
-
- /**
- * @generated
- */
- @Override
- 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());
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DefaultNamedElementItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DefaultNamedElementItemSemanticEditPolicy.java
deleted file mode 100644
index fde45895a8d..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DefaultNamedElementItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-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.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-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.notation.View;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyBranchCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeploymentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ManifestationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class DefaultNamedElementItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public DefaultNamedElementItemSemanticEditPolicy() {
- super(UMLElementTypes.NamedElement_2012);
- }
-
- /**
- * @generated
- */
- @Override
- 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());
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DependencyBranchItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DependencyBranchItemSemanticEditPolicy.java
deleted file mode 100644
index 251703addbf..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DependencyBranchItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyBranchCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeploymentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ManifestationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class DependencyBranchItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public DependencyBranchItemSemanticEditPolicy() {
- super(UMLElementTypes.Dependency_4010);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- EObject selectedEObject = req.getElementToDestroy();
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
- if (provider != null) {
- // Retrieve delete command from the Element Edit service
- ICommand deleteCommand = provider.getEditCommand(req);
-
- if (deleteCommand != null) {
- return new ICommandProxy(deleteCommand);
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DependencyItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DependencyItemSemanticEditPolicy.java
deleted file mode 100644
index 678734259c9..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DependencyItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyBranchCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeploymentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ManifestationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class DependencyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public DependencyItemSemanticEditPolicy() {
- super(UMLElementTypes.Dependency_4004);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- EObject selectedEObject = req.getElementToDestroy();
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
- if (provider != null) {
- // Retrieve delete command from the Element Edit service
- ICommand deleteCommand = provider.getEditCommand(req);
-
- if (deleteCommand != null) {
- return new ICommandProxy(deleteCommand);
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DependencyNodeItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DependencyNodeItemSemanticEditPolicy.java
deleted file mode 100644
index 5dea41ccd43..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DependencyNodeItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyBranchCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeploymentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ManifestationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class DependencyNodeItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public DependencyNodeItemSemanticEditPolicy() {
- super(UMLElementTypes.Dependency_2011);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- EObject selectedEObject = req.getElementToDestroy();
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
- if (provider != null) {
- // Retrieve delete command from the Element Edit service
- ICommand deleteCommand = provider.getEditCommand(req);
-
- if (deleteCommand != null) {
- return new ICommandProxy(deleteCommand);
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeploymentDiagramItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeploymentDiagramItemSemanticEditPolicy.java
deleted file mode 100644
index 7b3c319fc8c..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeploymentDiagramItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.commands.core.commands.DuplicateEObjectsCommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ArtifactCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DefaultNamedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyNodeCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeviceCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ExecutionEnvironmentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ModelCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.NodeCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.PackageCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class DeploymentDiagramItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public DeploymentDiagramItemSemanticEditPolicy() {
- super(UMLElementTypes.Package_1000);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateCommand(CreateElementRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return super.getCreateCommand(req);
- }
-
-
- if (UMLElementTypes.Dependency_2011 == requestElementType) {
-
- return getGEFWrapper(new DependencyNodeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Model_2010 == requestElementType) {
-
- return getGEFWrapper(new ModelCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Package_2009 == requestElementType) {
-
- return getGEFWrapper(new PackageCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Constraint_2005 == requestElementType) {
-
- return getGEFWrapper(new ConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Comment_2001 == requestElementType) {
-
- return getGEFWrapper(new CommentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.ExecutionEnvironment_2002 == requestElementType) {
-
- return getGEFWrapper(new ExecutionEnvironmentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Device_2003 == requestElementType) {
-
- return getGEFWrapper(new DeviceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Artifact_2006 == requestElementType) {
-
- return getGEFWrapper(new ArtifactCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Node_2008 == requestElementType) {
-
- return getGEFWrapper(new NodeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.NamedElement_2012 == requestElementType) {
-
- return getGEFWrapper(new DefaultNamedElementCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- return super.getCreateCommand(req);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getDuplicateCommand(DuplicateElementsRequest req) {
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
- return getGEFWrapper(new DuplicateAnythingCommand(editingDomain, req));
- }
-
- /**
- * @generated
- */
- private static class DuplicateAnythingCommand extends DuplicateEObjectsCommand {
-
- /**
- * @generated
- */
- public DuplicateAnythingCommand(TransactionalEditingDomain editingDomain, DuplicateElementsRequest req) {
- super(editingDomain, req.getLabel(), req.getElementsToBeDuplicated(), req.getAllDuplicatedElementsMap());
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeploymentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeploymentItemSemanticEditPolicy.java
deleted file mode 100644
index 93882cb599f..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeploymentItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyBranchCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeploymentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ManifestationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class DeploymentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public DeploymentItemSemanticEditPolicy() {
- super(UMLElementTypes.Deployment_4001);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- EObject selectedEObject = req.getElementToDestroy();
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
- if (provider != null) {
- // Retrieve delete command from the Element Edit service
- ICommand deleteCommand = provider.getEditCommand(req);
-
- if (deleteCommand != null) {
- return new ICommandProxy(deleteCommand);
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentCanonicalEditPolicy.java
deleted file mode 100644
index 9613fb5ab47..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentCanonicalEditPolicy.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-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.uml.diagram.deployment.edit.parts.DeviceEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramUpdater;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLNodeDescriptor;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class DeviceCompositeCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected EStructuralFeature getFeatureToSynchronize() {
- return UMLPackage.eINSTANCE.getNode_NestedNode();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<EObject> getSemanticChildrenList() {
- View viewObject = (View) getHost().getModel();
- LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
- .getDeviceDeviceCompositeCompartment_17SemanticChildren(viewObject);
- for (UMLNodeDescriptor d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- }
-
- /**
- * @generated
- */
- @Override
- protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) {
- return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement());
- }
-
- /**
- * @generated
- */
- private boolean isMyDiagramElement(View view) {
- int visualID = UMLVisualIDRegistry.getVisualID(view);
- return visualID == ExecutionEnvironmentEditPartCN.VISUAL_ID || visualID == DeviceEditPartCN.VISUAL_ID || visualID == NodeEditPartCN.VISUAL_ID;
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshSemantic() {
- if (resolveSemanticElement() == null) {
- return;
- }
- LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors =
- UMLDiagramUpdater.INSTANCE
- .getDeviceDeviceCompositeCompartment_17SemanticChildren((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/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentCanonicalEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentCanonicalEditPolicyCN.java
deleted file mode 100644
index c07377082cf..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentCanonicalEditPolicyCN.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-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.uml.diagram.deployment.edit.parts.DeviceEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramUpdater;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLNodeDescriptor;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class DeviceCompositeCompartmentCanonicalEditPolicyCN extends CanonicalEditPolicy {
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected EStructuralFeature getFeatureToSynchronize() {
- return UMLPackage.eINSTANCE.getNode_NestedNode();
- }
-
- /**
- * @generated
- */
- @Override
- protected List<EObject> getSemanticChildrenList() {
- View viewObject = (View) getHost().getModel();
- LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
- .getDeviceDeviceCompositeCompartment_30SemanticChildren(viewObject);
- for (UMLNodeDescriptor d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- }
-
- /**
- * @generated
- */
- @Override
- protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) {
- return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement());
- }
-
- /**
- * @generated
- */
- private boolean isMyDiagramElement(View view) {
- int visualID = UMLVisualIDRegistry.getVisualID(view);
- return visualID == ExecutionEnvironmentEditPartCN.VISUAL_ID || visualID == DeviceEditPartCN.VISUAL_ID || visualID == NodeEditPartCN.VISUAL_ID;
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshSemantic() {
- if (resolveSemanticElement() == null) {
- return;
- }
- LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors =
- UMLDiagramUpdater.INSTANCE
- .getDeviceDeviceCompositeCompartment_30SemanticChildren((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/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentItemSemanticEditPolicy.java
deleted file mode 100644
index a8882e01890..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeviceCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ExecutionEnvironmentCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.NodeCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class DeviceCompositeCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public DeviceCompositeCompartmentItemSemanticEditPolicy() {
- super(UMLElementTypes.Device_2003);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateCommand(CreateElementRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return super.getCreateCommand(req);
- }
-
-
- if (UMLElementTypes.ExecutionEnvironment_21 == requestElementType) {
-
- return getGEFWrapper(new ExecutionEnvironmentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Device_16 == requestElementType) {
-
- return getGEFWrapper(new DeviceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Node_23 == requestElementType) {
-
- return getGEFWrapper(new NodeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- return super.getCreateCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentItemSemanticEditPolicyCN.java
deleted file mode 100644
index 6563490f39b..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentItemSemanticEditPolicyCN.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeviceCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ExecutionEnvironmentCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.NodeCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class DeviceCompositeCompartmentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public DeviceCompositeCompartmentItemSemanticEditPolicyCN() {
- super(UMLElementTypes.Device_44);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateCommand(CreateElementRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return super.getCreateCommand(req);
- }
-
-
- if (UMLElementTypes.ExecutionEnvironment_21 == requestElementType) {
-
- return getGEFWrapper(new ExecutionEnvironmentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Device_16 == requestElementType) {
-
- return getGEFWrapper(new DeviceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Node_23 == requestElementType) {
-
- return getGEFWrapper(new NodeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- return super.getCreateCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceItemSemanticEditPolicy.java
deleted file mode 100644
index 6ac83ffb0df..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyBranchCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeploymentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.GeneralizationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ManifestationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class DeviceItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public DeviceItemSemanticEditPolicy() {
- super(UMLElementTypes.Device_2003);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- EObject selectedEObject = req.getElementToDestroy();
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
- if (provider != null) {
- // Retrieve delete command from the Element Edit service
- ICommand deleteCommand = provider.getEditCommand(req);
-
- if (deleteCommand != null) {
- return new ICommandProxy(deleteCommand);
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceItemSemanticEditPolicyCN.java
deleted file mode 100644
index 47e58cb6331..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceItemSemanticEditPolicyCN.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-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.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-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.notation.View;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyBranchCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeploymentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.GeneralizationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ManifestationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class DeviceItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public DeviceItemSemanticEditPolicyCN() {
- super(UMLElementTypes.Device_16);
- }
-
- /**
- * @generated
- */
- @Override
- 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());
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicy.java
deleted file mode 100644
index 3c4746193d3..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicy.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.uml.diagram.deployment.edit.parts.ArtifactEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramUpdater;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLNodeDescriptor;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
-
- /**
- * @generated
- */
- private Set<EStructuralFeature> myFeaturesToSynchronize;
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected Set<EStructuralFeature> getFeaturesToSynchronize() {
- if (myFeaturesToSynchronize == null) {
- myFeaturesToSynchronize = new HashSet<EStructuralFeature>();
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getNode_NestedNode());
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getClass_NestedClassifier());
- }
- return myFeaturesToSynchronize;
- }
-
- /**
- * @generated
- */
- @Override
- protected List<EObject> getSemanticChildrenList() {
- View viewObject = (View) getHost().getModel();
- LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
- .getExecutionEnvironmentExecutionEnvironmentCompositeCompartment_18SemanticChildren(viewObject);
- for (UMLNodeDescriptor d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- }
-
- /**
- * @generated
- */
- @Override
- protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) {
- return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement());
- }
-
- /**
- * @generated
- */
- private boolean isMyDiagramElement(View view) {
- int visualID = UMLVisualIDRegistry.getVisualID(view);
- return visualID == ExecutionEnvironmentEditPartCN.VISUAL_ID || visualID == ArtifactEditPartCN.VISUAL_ID;
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshSemantic() {
- if (resolveSemanticElement() == null) {
- return;
- }
- LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors =
- UMLDiagramUpdater.INSTANCE
- .getExecutionEnvironmentExecutionEnvironmentCompositeCompartment_18SemanticChildren((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/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicyCN.java
deleted file mode 100644
index 2b7b6d61eb2..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicyCN.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.uml.diagram.deployment.edit.parts.ArtifactEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramUpdater;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLNodeDescriptor;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicyCN extends CanonicalEditPolicy {
-
- /**
- * @generated
- */
- private Set<EStructuralFeature> myFeaturesToSynchronize;
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected Set<EStructuralFeature> getFeaturesToSynchronize() {
- if (myFeaturesToSynchronize == null) {
- myFeaturesToSynchronize = new HashSet<EStructuralFeature>();
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getClass_NestedClassifier());
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getNode_NestedNode());
- }
- return myFeaturesToSynchronize;
- }
-
- /**
- * @generated
- */
- @Override
- protected List<EObject> getSemanticChildrenList() {
- View viewObject = (View) getHost().getModel();
- LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
- .getExecutionEnvironmentExecutionEnvironmentCompositeCompartment_31SemanticChildren(viewObject);
- for (UMLNodeDescriptor d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- }
-
- /**
- * @generated
- */
- @Override
- protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) {
- return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement());
- }
-
- /**
- * @generated
- */
- private boolean isMyDiagramElement(View view) {
- int visualID = UMLVisualIDRegistry.getVisualID(view);
- return visualID == ArtifactEditPartCN.VISUAL_ID || visualID == ExecutionEnvironmentEditPartCN.VISUAL_ID;
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshSemantic() {
- if (resolveSemanticElement() == null) {
- return;
- }
- LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors =
- UMLDiagramUpdater.INSTANCE
- .getExecutionEnvironmentExecutionEnvironmentCompositeCompartment_31SemanticChildren((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/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicy.java
deleted file mode 100644
index 504bf69dde6..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ArtifactCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ExecutionEnvironmentCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicy() {
- super(UMLElementTypes.ExecutionEnvironment_2002);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateCommand(CreateElementRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return super.getCreateCommand(req);
- }
-
-
- if (UMLElementTypes.ExecutionEnvironment_21 == requestElementType) {
-
- return getGEFWrapper(new ExecutionEnvironmentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Artifact_25 == requestElementType) {
-
- return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- return super.getCreateCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicyCN.java
deleted file mode 100644
index 6f011cfe3fb..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicyCN.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ArtifactCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ExecutionEnvironmentCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicyCN() {
- super(UMLElementTypes.ExecutionEnvironment_46);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateCommand(CreateElementRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return super.getCreateCommand(req);
- }
-
-
- if (UMLElementTypes.Artifact_25 == requestElementType) {
-
- return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.ExecutionEnvironment_21 == requestElementType) {
-
- return getGEFWrapper(new ExecutionEnvironmentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- return super.getCreateCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentItemSemanticEditPolicy.java
deleted file mode 100644
index 07280fea799..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyBranchCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeploymentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.GeneralizationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ManifestationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class ExecutionEnvironmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public ExecutionEnvironmentItemSemanticEditPolicy() {
- super(UMLElementTypes.ExecutionEnvironment_2002);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- EObject selectedEObject = req.getElementToDestroy();
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
- if (provider != null) {
- // Retrieve delete command from the Element Edit service
- ICommand deleteCommand = provider.getEditCommand(req);
-
- if (deleteCommand != null) {
- return new ICommandProxy(deleteCommand);
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentItemSemanticEditPolicyCN.java
deleted file mode 100644
index 7a388f53636..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentItemSemanticEditPolicyCN.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-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.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-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.notation.View;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyBranchCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeploymentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.GeneralizationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ManifestationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class ExecutionEnvironmentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public ExecutionEnvironmentItemSemanticEditPolicyCN() {
- super(UMLElementTypes.ExecutionEnvironment_21);
- }
-
- /**
- * @generated
- */
- @Override
- 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());
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/GeneralizationItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/GeneralizationItemSemanticEditPolicy.java
deleted file mode 100644
index f4e6f5f1c7a..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/GeneralizationItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class GeneralizationItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public GeneralizationItemSemanticEditPolicy() {
- super(UMLElementTypes.Generalization_4003);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- EObject selectedEObject = req.getElementToDestroy();
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
- if (provider != null) {
- // Retrieve delete command from the Element Edit service
- ICommand deleteCommand = provider.getEditCommand(req);
-
- if (deleteCommand != null) {
- return new ICommandProxy(deleteCommand);
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ManifestationItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ManifestationItemSemanticEditPolicy.java
deleted file mode 100644
index 8b15a004e7e..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ManifestationItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyBranchCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeploymentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ManifestationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class ManifestationItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public ManifestationItemSemanticEditPolicy() {
- super(UMLElementTypes.Manifestation_4002);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- EObject selectedEObject = req.getElementToDestroy();
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
- if (provider != null) {
- // Retrieve delete command from the Element Edit service
- ICommand deleteCommand = provider.getEditCommand(req);
-
- if (deleteCommand != null) {
- return new ICommandProxy(deleteCommand);
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelCanonicalEditPolicy.java
deleted file mode 100644
index b22599883a4..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelCanonicalEditPolicy.java
+++ /dev/null
@@ -1,639 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-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.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.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.gmf.tooling.runtime.update.UpdaterLinkDescriptor;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPartACN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DefaultNamedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNodeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.LinkDescriptorEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedArtifactNodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedDeviceEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedExecutionEnvironmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedNodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramUpdater;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLLinkDescriptor;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLNodeDescriptor;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ModelCanonicalEditPolicy extends CanonicalEditPolicy {
-
- /**
- * @generated
- */
- private Set<EStructuralFeature> myFeaturesToSynchronize;
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected Set<EStructuralFeature> getFeaturesToSynchronize() {
- if (myFeaturesToSynchronize == null) {
- myFeaturesToSynchronize = new HashSet<EStructuralFeature>();
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getPackage_PackagedElement());
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getElement_OwnedComment());
- }
- return myFeaturesToSynchronize;
- }
-
- /**
- * @generated
- */
- @Override
- protected List<EObject> getSemanticChildrenList() {
- View viewObject = (View) getHost().getModel();
- LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
- .getPackage_1000SemanticChildren(viewObject);
- for (UMLNodeDescriptor d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- }
-
- /**
- * @generated
- */
- @Override
- protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) {
- return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement());
- }
-
- /**
- * @generated
- */
- private boolean isMyDiagramElement(View view) {
- int visualID = UMLVisualIDRegistry.getVisualID(view);
- switch (visualID) {
- case DependencyNodeEditPart.VISUAL_ID:
- case ModelEditPart.VISUAL_ID:
- case PackageEditPart.VISUAL_ID:
- case ConstraintEditPart.VISUAL_ID:
- case CommentEditPart.VISUAL_ID:
- case ExecutionEnvironmentEditPart.VISUAL_ID:
- case DeviceEditPart.VISUAL_ID:
- case ArtifactEditPart.VISUAL_ID:
- case NodeEditPart.VISUAL_ID:
- case DefaultNamedElementEditPart.VISUAL_ID:
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshSemantic() {
- if (resolveSemanticElement() == null) {
- return;
- }
- LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors =
- UMLDiagramUpdater.INSTANCE
- .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);
- }
-
- /**
- * @generated
- */
- private Collection<IAdaptable> refreshConnections() {
- Domain2Notation domain2NotationMap = new Domain2Notation();
- Collection<UMLLinkDescriptor> linkDescriptors = collectAllLinks(getDiagram(), domain2NotationMap);
- List<View> edges = new ArrayList<View>();
- for (Object edge : getDiagram().getEdges())
- {
- if (edge instanceof View)
- {
- edges.add((View) edge);
- }
- }
- Collection<View> existingLinks = new LinkedList<View>(edges);
- for (Iterator<View> linksIterator = existingLinks.iterator(); linksIterator.hasNext();) {
- Edge nextDiagramLink = (Edge) linksIterator.next();
- int diagramLinkVisualID = UMLVisualIDRegistry.getVisualID(nextDiagramLink);
- if (diagramLinkVisualID == -1 || diagramLinkVisualID == LinkDescriptorEditPart.VISUAL_ID) {
- 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
- */
- private Collection<UMLLinkDescriptor> collectAllLinks(View view, Domain2Notation domain2NotationMap) {
- if (!DeploymentDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view))) {
- return Collections.emptyList();
- }
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- switch (UMLVisualIDRegistry.getVisualID(view)) {
- case DeploymentDiagramEditPart.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getPackage_1000ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case DependencyNodeEditPart.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getDependency_2011ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case ModelEditPart.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getModel_2010ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case PackageEditPart.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getPackage_2009ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case ConstraintEditPart.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getConstraint_2005ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case CommentEditPart.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getComment_2001ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case ExecutionEnvironmentEditPart.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getExecutionEnvironment_2002ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case DeviceEditPart.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getDevice_2003ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case ArtifactEditPart.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getArtifact_2006ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case NodeEditPart.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getNode_2008ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case DefaultNamedElementEditPart.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getNamedElement_2012ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case ModelEditPartCN.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getModel_49ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case PackageEditPartCN.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getPackage_36ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case DeviceEditPartCN.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getDevice_16ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case NestedDeviceEditPartCN.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getDevice_44ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case ExecutionEnvironmentEditPartCN.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getExecutionEnvironment_21ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case NestedExecutionEnvironmentEditPartCN.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getExecutionEnvironment_46ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case NodeEditPartCN.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getNode_23ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case NestedNodeEditPartCN.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getNode_42ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case ArtifactEditPartCN.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getArtifact_25ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case ArtifactEditPartACN.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getArtifact_28ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case NestedArtifactNodeEditPartCN.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getArtifact_40ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case CommentEditPartCN.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getComment_54ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case ConstraintEditPartCN.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getConstraint_56ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case DeploymentEditPart.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getDeployment_4001ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case ManifestationEditPart.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getManifestation_4002ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case GeneralizationEditPart.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getGeneralization_4003ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case DependencyEditPart.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getDependency_4004ContainedLinks(view));
- }
- domain2NotationMap.putView(view.getElement(), view);
- break;
- }
- case DependencyBranchEditPart.VISUAL_ID: {
- if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE
- .getDependency_4010ContainedLinks(view));
- }
- domain2NotationMap.putView(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, Domain2Notation domain2NotationMap) {
- LinkedList<IAdaptable> adapters = new LinkedList<IAdaptable>();
- for (UMLLinkDescriptor nextLinkDescriptor : linkDescriptors) {
- EditPart sourceEditPart = getSourceEditPart(nextLinkDescriptor, domain2NotationMap);
- EditPart targetEditPart = getTargetEditPart(nextLinkDescriptor, 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(org.eclipse.gef.RequestConstants.REQ_CONNECTION_START);
- ccr.setSourceEditPart(sourceEditPart);
- sourceEditPart.getCommand(ccr);
- ccr.setTargetEditPart(targetEditPart);
- ccr.setType(org.eclipse.gef.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 EditPart getEditPart(EObject domainModelElement, Domain2Notation domain2NotationMap) {
- View view = domain2NotationMap.get(domainModelElement);
- if (view != null) {
- return (EditPart) getHost().getViewer().getEditPartRegistry().get(view);
- }
- return null;
- }
-
- /**
- * @generated
- */
- private Diagram getDiagram() {
- return ((View) getHost().getModel()).getDiagram();
- }
-
- /**
- * @generated
- */
- private EditPart getSourceEditPart(UpdaterLinkDescriptor descriptor, Domain2Notation domain2NotationMap) {
- return getEditPart(descriptor.getSource(), domain2NotationMap);
- }
-
- /**
- * @generated
- */
- private EditPart getTargetEditPart(UpdaterLinkDescriptor descriptor, Domain2Notation domain2NotationMap) {
- return getEditPart(descriptor.getDestination(), domain2NotationMap);
- }
-
- /**
- * @generated
- */
- protected final EditPart getHintedEditPart(EObject domainModelElement, Domain2Notation domain2NotationMap, int hintVisualId) {
- View view = domain2NotationMap.getHinted(domainModelElement, UMLVisualIDRegistry.getType(hintVisualId));
- if (view != null) {
- return (EditPart) getHost().getViewer().getEditPartRegistry().get(view);
- }
- return null;
- }
-
- /**
- * @generated
- */
- @SuppressWarnings("serial")
- protected static class Domain2Notation extends HashMap<EObject, View> {
-
- /**
- * @generated
- */
- public boolean containsDomainElement(EObject domainElement) {
- return this.containsKey(domainElement);
- }
-
- /**
- * @generated
- */
- public View getHinted(EObject domainEObject, String hint) {
- return this.get(domainEObject);
- }
-
- /**
- * @generated
- */
- public void putView(EObject domainElement, View view) {
- if (!containsKey(view.getElement())) {
- this.put(domainElement, view);
- }
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelItemSemanticEditPolicy.java
deleted file mode 100644
index 69ae980cc96..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,535 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.emf.edit.command.DeleteCommand;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
-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.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand;
-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.ReorientReferenceRelationshipRequest;
-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.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyBranchCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeploymentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ManifestationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelPackageableElementCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedArtifactNodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedDeviceEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedExecutionEnvironmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedNodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public ModelItemSemanticEditPolicy() {
- super(UMLElementTypes.Model_2010);
- }
-
- /**
- * @generated
- */
- @Override
- 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 DeleteCommand(getEditingDomain(), todestroy)));
- } else {
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
- /**
- * @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 ModelPackageableElementCompartmentEditPart.VISUAL_ID:
- for (Iterator<?> cit = node.getChildren().iterator(); cit.hasNext();) {
- Node cnode = (Node) cit.next();
- switch (UMLVisualIDRegistry.getVisualID(cnode)) {
- case ModelEditPartCN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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 PackageEditPartCN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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 NestedDeviceEditPartCN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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 NestedExecutionEnvironmentEditPartCN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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 NestedNodeEditPartCN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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 NestedArtifactNodeEditPartCN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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 CommentEditPartCN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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 ConstraintEditPartCN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelItemSemanticEditPolicyCN.java
deleted file mode 100644
index e63a35ffea4..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelItemSemanticEditPolicyCN.java
+++ /dev/null
@@ -1,535 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.emf.edit.command.DeleteCommand;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
-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.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand;
-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.ReorientReferenceRelationshipRequest;
-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.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyBranchCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeploymentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ManifestationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelPackageableElementCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedArtifactNodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedDeviceEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedExecutionEnvironmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedNodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public ModelItemSemanticEditPolicyCN() {
- super(UMLElementTypes.Model_49);
- }
-
- /**
- * @generated
- */
- @Override
- 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 DeleteCommand(getEditingDomain(), todestroy)));
- } else {
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
- /**
- * @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 ModelPackageableElementCompartmentEditPartCN.VISUAL_ID:
- for (Iterator<?> cit = node.getChildren().iterator(); cit.hasNext();) {
- Node cnode = (Node) cit.next();
- switch (UMLVisualIDRegistry.getVisualID(cnode)) {
- case ModelEditPartCN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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 PackageEditPartCN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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 NestedDeviceEditPartCN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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 NestedExecutionEnvironmentEditPartCN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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 NestedNodeEditPartCN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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 NestedArtifactNodeEditPartCN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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 CommentEditPartCN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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 ConstraintEditPartCN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicy.java
deleted file mode 100644
index 59d9660b474..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicy.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.uml.diagram.deployment.edit.parts.CommentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedArtifactNodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedDeviceEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedExecutionEnvironmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedNodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramUpdater;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLNodeDescriptor;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ModelPackageableElementCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
-
- /**
- * @generated
- */
- private Set<EStructuralFeature> myFeaturesToSynchronize;
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected Set<EStructuralFeature> getFeaturesToSynchronize() {
- if (myFeaturesToSynchronize == null) {
- myFeaturesToSynchronize = new HashSet<EStructuralFeature>();
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getPackage_PackagedElement());
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getElement_OwnedComment());
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getNamespace_OwnedRule());
- }
- return myFeaturesToSynchronize;
- }
-
- /**
- * @generated
- */
- @Override
- protected List<EObject> getSemanticChildrenList() {
- View viewObject = (View) getHost().getModel();
- LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
- .getModelModelCompartment_51SemanticChildren(viewObject);
- for (UMLNodeDescriptor d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- }
-
- /**
- * @generated
- */
- @Override
- protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) {
- return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement());
- }
-
- /**
- * @generated
- */
- private boolean isMyDiagramElement(View view) {
- int visualID = UMLVisualIDRegistry.getVisualID(view);
- switch (visualID) {
- case ModelEditPartCN.VISUAL_ID:
- case PackageEditPartCN.VISUAL_ID:
- case NestedDeviceEditPartCN.VISUAL_ID:
- case NestedExecutionEnvironmentEditPartCN.VISUAL_ID:
- case NestedNodeEditPartCN.VISUAL_ID:
- case NestedArtifactNodeEditPartCN.VISUAL_ID:
- case CommentEditPartCN.VISUAL_ID:
- case ConstraintEditPartCN.VISUAL_ID:
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshSemantic() {
- if (resolveSemanticElement() == null) {
- return;
- }
- LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors =
- UMLDiagramUpdater.INSTANCE
- .getModelModelCompartment_51SemanticChildren((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/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicyCN.java
deleted file mode 100644
index 5d7203b6d64..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicyCN.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.uml.diagram.deployment.edit.parts.CommentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedArtifactNodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedDeviceEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedExecutionEnvironmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedNodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramUpdater;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLNodeDescriptor;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ModelPackageableElementCompartmentCanonicalEditPolicyCN extends CanonicalEditPolicy {
-
- /**
- * @generated
- */
- private Set<EStructuralFeature> myFeaturesToSynchronize;
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected Set<EStructuralFeature> getFeaturesToSynchronize() {
- if (myFeaturesToSynchronize == null) {
- myFeaturesToSynchronize = new HashSet<EStructuralFeature>();
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getPackage_PackagedElement());
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getElement_OwnedComment());
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getNamespace_OwnedRule());
- }
- return myFeaturesToSynchronize;
- }
-
- /**
- * @generated
- */
- @Override
- protected List<EObject> getSemanticChildrenList() {
- View viewObject = (View) getHost().getModel();
- LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
- .getModelModelCompartment_52SemanticChildren(viewObject);
- for (UMLNodeDescriptor d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- }
-
- /**
- * @generated
- */
- @Override
- protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) {
- return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement());
- }
-
- /**
- * @generated
- */
- private boolean isMyDiagramElement(View view) {
- int visualID = UMLVisualIDRegistry.getVisualID(view);
- switch (visualID) {
- case ModelEditPartCN.VISUAL_ID:
- case PackageEditPartCN.VISUAL_ID:
- case NestedDeviceEditPartCN.VISUAL_ID:
- case NestedExecutionEnvironmentEditPartCN.VISUAL_ID:
- case NestedNodeEditPartCN.VISUAL_ID:
- case NestedArtifactNodeEditPartCN.VISUAL_ID:
- case CommentEditPartCN.VISUAL_ID:
- case ConstraintEditPartCN.VISUAL_ID:
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshSemantic() {
- if (resolveSemanticElement() == null) {
- return;
- }
- LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors =
- UMLDiagramUpdater.INSTANCE
- .getModelModelCompartment_52SemanticChildren((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/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicy.java
deleted file mode 100644
index de4d08a0e1f..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ModelCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.NestedArtifactNodeCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.NestedDeviceCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.NestedExecutionEnvironmentCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.NestedNodeCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.PackageCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class ModelPackageableElementCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public ModelPackageableElementCompartmentItemSemanticEditPolicy() {
- super(UMLElementTypes.Model_2010);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateCommand(CreateElementRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return super.getCreateCommand(req);
- }
-
-
- if (UMLElementTypes.Model_49 == requestElementType) {
-
- return getGEFWrapper(new ModelCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Package_36 == requestElementType) {
-
- return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Device_44 == requestElementType) {
-
- return getGEFWrapper(new NestedDeviceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.ExecutionEnvironment_46 == requestElementType) {
-
- return getGEFWrapper(new NestedExecutionEnvironmentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Node_42 == requestElementType) {
-
- return getGEFWrapper(new NestedNodeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Artifact_40 == requestElementType) {
-
- return getGEFWrapper(new NestedArtifactNodeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Comment_54 == requestElementType) {
-
- return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Constraint_56 == requestElementType) {
-
- return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- return super.getCreateCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyCN.java
deleted file mode 100644
index d67246883c8..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyCN.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ModelCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.NestedArtifactNodeCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.NestedDeviceCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.NestedExecutionEnvironmentCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.NestedNodeCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.PackageCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class ModelPackageableElementCompartmentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public ModelPackageableElementCompartmentItemSemanticEditPolicyCN() {
- super(UMLElementTypes.Model_49);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateCommand(CreateElementRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return super.getCreateCommand(req);
- }
-
-
- if (UMLElementTypes.Model_49 == requestElementType) {
-
- return getGEFWrapper(new ModelCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Package_36 == requestElementType) {
-
- return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Device_44 == requestElementType) {
-
- return getGEFWrapper(new NestedDeviceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.ExecutionEnvironment_46 == requestElementType) {
-
- return getGEFWrapper(new NestedExecutionEnvironmentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Node_42 == requestElementType) {
-
- return getGEFWrapper(new NestedNodeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Artifact_40 == requestElementType) {
-
- return getGEFWrapper(new NestedArtifactNodeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Comment_54 == requestElementType) {
-
- return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Constraint_56 == requestElementType) {
-
- return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- return super.getCreateCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedArtifactNodeItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedArtifactNodeItemSemanticEditPolicyCN.java
deleted file mode 100644
index ef4ed78ec07..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedArtifactNodeItemSemanticEditPolicyCN.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-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.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-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.notation.View;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyBranchCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeploymentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.GeneralizationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ManifestationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class NestedArtifactNodeItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public NestedArtifactNodeItemSemanticEditPolicyCN() {
- super(UMLElementTypes.Artifact_40);
- }
-
- /**
- * @generated
- */
- @Override
- 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());
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedDeviceItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedDeviceItemSemanticEditPolicyCN.java
deleted file mode 100644
index 79dc065a4d2..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedDeviceItemSemanticEditPolicyCN.java
+++ /dev/null
@@ -1,403 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.emf.edit.command.DeleteCommand;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
-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.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand;
-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.ReorientReferenceRelationshipRequest;
-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.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyBranchCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeploymentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.GeneralizationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ManifestationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceCompositeCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class NestedDeviceItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public NestedDeviceItemSemanticEditPolicyCN() {
- super(UMLElementTypes.Device_44);
- }
-
- /**
- * @generated
- */
- @Override
- 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 DeleteCommand(getEditingDomain(), todestroy)));
- } else {
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
- /**
- * @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 DeviceCompositeCompartmentEditPartCN.VISUAL_ID:
- for (Iterator<?> cit = node.getChildren().iterator(); cit.hasNext();) {
- Node cnode = (Node) cit.next();
- switch (UMLVisualIDRegistry.getVisualID(cnode)) {
- case ExecutionEnvironmentEditPartCN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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 DeviceEditPartCN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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 NodeEditPartCN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedExecutionEnvironmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedExecutionEnvironmentItemSemanticEditPolicyCN.java
deleted file mode 100644
index 0c396d45e93..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedExecutionEnvironmentItemSemanticEditPolicyCN.java
+++ /dev/null
@@ -1,371 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.emf.edit.command.DeleteCommand;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
-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.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand;
-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.ReorientReferenceRelationshipRequest;
-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.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyBranchCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeploymentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.GeneralizationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ManifestationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentCompositeCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class NestedExecutionEnvironmentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public NestedExecutionEnvironmentItemSemanticEditPolicyCN() {
- super(UMLElementTypes.ExecutionEnvironment_46);
- }
-
- /**
- * @generated
- */
- @Override
- 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 DeleteCommand(getEditingDomain(), todestroy)));
- } else {
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
- /**
- * @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 ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID:
- for (Iterator<?> cit = node.getChildren().iterator(); cit.hasNext();) {
- Node cnode = (Node) cit.next();
- switch (UMLVisualIDRegistry.getVisualID(cnode)) {
- case ArtifactEditPartCN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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 ExecutionEnvironmentEditPartCN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedNodeItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedNodeItemSemanticEditPolicyCN.java
deleted file mode 100644
index 2fd05b8e24b..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedNodeItemSemanticEditPolicyCN.java
+++ /dev/null
@@ -1,435 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.emf.edit.command.DeleteCommand;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
-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.DestroyElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand;
-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.ReorientReferenceRelationshipRequest;
-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.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyBranchCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeploymentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.GeneralizationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ManifestationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeCompositeCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class NestedNodeItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public NestedNodeItemSemanticEditPolicyCN() {
- super(UMLElementTypes.Node_42);
- }
-
- /**
- * @generated
- */
- @Override
- 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 DeleteCommand(getEditingDomain(), todestroy)));
- } else {
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
- }
-
- /**
- * @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 NodeCompositeCompartmentEditPartCN.VISUAL_ID:
- for (Iterator<?> cit = node.getChildren().iterator(); cit.hasNext();) {
- Node cnode = (Node) cit.next();
- switch (UMLVisualIDRegistry.getVisualID(cnode)) {
- case DeviceEditPartCN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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 ExecutionEnvironmentEditPartCN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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 NodeEditPartCN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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 ArtifactEditPartCN.VISUAL_ID:
-
-
-
-
-
- for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
- Edge incomingLink = (Edge) it.next();
- switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- DestroyReferenceRequest destroyRefReq = new DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false);
- cmd.add(new DestroyReferenceCommand(destroyRefReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- break;
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- DestroyElementRequest destroyEltReq = new DestroyElementRequest(incomingLink.getElement(), false);
- cmd.add(new DestroyElementCommand(destroyEltReq));
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- 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
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentCanonicalEditPolicy.java
deleted file mode 100644
index 31563a97a95..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentCanonicalEditPolicy.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.uml.diagram.deployment.edit.parts.ArtifactEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramUpdater;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLNodeDescriptor;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class NodeCompositeCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
-
- /**
- * @generated
- */
- private Set<EStructuralFeature> myFeaturesToSynchronize;
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected Set<EStructuralFeature> getFeaturesToSynchronize() {
- if (myFeaturesToSynchronize == null) {
- myFeaturesToSynchronize = new HashSet<EStructuralFeature>();
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getNode_NestedNode());
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getClass_NestedClassifier());
- }
- return myFeaturesToSynchronize;
- }
-
- /**
- * @generated
- */
- @Override
- protected List<EObject> getSemanticChildrenList() {
- View viewObject = (View) getHost().getModel();
- LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
- .getNodeCompositeCompartment_19SemanticChildren(viewObject);
- for (UMLNodeDescriptor d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- }
-
- /**
- * @generated
- */
- @Override
- protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) {
- return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement());
- }
-
- /**
- * @generated
- */
- private boolean isMyDiagramElement(View view) {
- int visualID = UMLVisualIDRegistry.getVisualID(view);
- switch (visualID) {
- case DeviceEditPartCN.VISUAL_ID:
- case ExecutionEnvironmentEditPartCN.VISUAL_ID:
- case ArtifactEditPartCN.VISUAL_ID:
- case NodeEditPartCN.VISUAL_ID:
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshSemantic() {
- if (resolveSemanticElement() == null) {
- return;
- }
- LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors =
- UMLDiagramUpdater.INSTANCE
- .getNodeCompositeCompartment_19SemanticChildren((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/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentCanonicalEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentCanonicalEditPolicyCN.java
deleted file mode 100644
index 7aadd0be3d4..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentCanonicalEditPolicyCN.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.uml.diagram.deployment.edit.parts.ArtifactEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramUpdater;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLNodeDescriptor;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class NodeCompositeCompartmentCanonicalEditPolicyCN extends CanonicalEditPolicy {
-
- /**
- * @generated
- */
- private Set<EStructuralFeature> myFeaturesToSynchronize;
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected Set<EStructuralFeature> getFeaturesToSynchronize() {
- if (myFeaturesToSynchronize == null) {
- myFeaturesToSynchronize = new HashSet<EStructuralFeature>();
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getNode_NestedNode());
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getClass_NestedClassifier());
- }
- return myFeaturesToSynchronize;
- }
-
- /**
- * @generated
- */
- @Override
- protected List<EObject> getSemanticChildrenList() {
- View viewObject = (View) getHost().getModel();
- LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
- .getNodeCompositeCompartment_32SemanticChildren(viewObject);
- for (UMLNodeDescriptor d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- }
-
- /**
- * @generated
- */
- @Override
- protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) {
- return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement());
- }
-
- /**
- * @generated
- */
- private boolean isMyDiagramElement(View view) {
- int visualID = UMLVisualIDRegistry.getVisualID(view);
- switch (visualID) {
- case DeviceEditPartCN.VISUAL_ID:
- case ExecutionEnvironmentEditPartCN.VISUAL_ID:
- case NodeEditPartCN.VISUAL_ID:
- case ArtifactEditPartCN.VISUAL_ID:
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshSemantic() {
- if (resolveSemanticElement() == null) {
- return;
- }
- LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors =
- UMLDiagramUpdater.INSTANCE
- .getNodeCompositeCompartment_32SemanticChildren((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/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentItemSemanticEditPolicy.java
deleted file mode 100644
index 22cf7877d7a..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ArtifactCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeviceCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ExecutionEnvironmentCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.NodeCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class NodeCompositeCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public NodeCompositeCompartmentItemSemanticEditPolicy() {
- super(UMLElementTypes.Node_2008);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateCommand(CreateElementRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return super.getCreateCommand(req);
- }
-
-
- if (UMLElementTypes.Device_16 == requestElementType) {
-
- return getGEFWrapper(new DeviceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.ExecutionEnvironment_21 == requestElementType) {
-
- return getGEFWrapper(new ExecutionEnvironmentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Artifact_25 == requestElementType) {
-
- return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Node_23 == requestElementType) {
-
- return getGEFWrapper(new NodeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- return super.getCreateCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentItemSemanticEditPolicyCN.java
deleted file mode 100644
index 14c946ff61c..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentItemSemanticEditPolicyCN.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ArtifactCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeviceCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ExecutionEnvironmentCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.NodeCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class NodeCompositeCompartmentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public NodeCompositeCompartmentItemSemanticEditPolicyCN() {
- super(UMLElementTypes.Node_42);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateCommand(CreateElementRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return super.getCreateCommand(req);
- }
-
-
- if (UMLElementTypes.Device_16 == requestElementType) {
-
- return getGEFWrapper(new DeviceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.ExecutionEnvironment_21 == requestElementType) {
-
- return getGEFWrapper(new ExecutionEnvironmentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Node_23 == requestElementType) {
-
- return getGEFWrapper(new NodeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Artifact_25 == requestElementType) {
-
- return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- return super.getCreateCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeItemSemanticEditPolicy.java
deleted file mode 100644
index f4c5268b141..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyBranchCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeploymentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.GeneralizationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ManifestationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class NodeItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public NodeItemSemanticEditPolicy() {
- super(UMLElementTypes.Node_2008);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- EObject selectedEObject = req.getElementToDestroy();
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
- if (provider != null) {
- // Retrieve delete command from the Element Edit service
- ICommand deleteCommand = provider.getEditCommand(req);
-
- if (deleteCommand != null) {
- return new ICommandProxy(deleteCommand);
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeItemSemanticEditPolicyCN.java
deleted file mode 100644
index 710822d18fc..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeItemSemanticEditPolicyCN.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-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.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-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.notation.View;
-import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyBranchCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeploymentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.GeneralizationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ManifestationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class NodeItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public NodeItemSemanticEditPolicyCN() {
- super(UMLElementTypes.Node_23);
- }
-
- /**
- * @generated
- */
- @Override
- 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());
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Generalization_4003 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new GeneralizationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case GeneralizationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackageItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackageItemSemanticEditPolicy.java
deleted file mode 100644
index 53b125bf66a..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackageItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyBranchCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeploymentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ManifestationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class PackageItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public PackageItemSemanticEditPolicy() {
- super(UMLElementTypes.Package_2009);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- EObject selectedEObject = req.getElementToDestroy();
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
- if (provider != null) {
- // Retrieve delete command from the Element Edit service
- ICommand deleteCommand = provider.getEditCommand(req);
-
- if (deleteCommand != null) {
- return new ICommandProxy(deleteCommand);
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackageItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackageItemSemanticEditPolicyCN.java
deleted file mode 100644
index 41db292f1cb..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackageItemSemanticEditPolicyCN.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentAnnotatedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintConstrainedElementReorientCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyBranchCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DependencyCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeploymentCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ManifestationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class PackageItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public PackageItemSemanticEditPolicyCN() {
- super(UMLElementTypes.Package_36);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- EObject selectedEObject = req.getElementToDestroy();
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
- if (provider != null) {
- // Retrieve delete command from the Element Edit service
- ICommand deleteCommand = provider.getEditCommand(req);
-
- if (deleteCommand != null) {
- return new ICommandProxy(deleteCommand);
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ?
- getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
- return command != null ? command : super.getCreateRelationshipCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- return null;
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return null;
- }
- IElementType baseElementType = requestElementType;
- boolean isExtendedType = false;
- if (requestElementType instanceof IExtendedHintedElementType) {
- baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType);
- if (baseElementType != null) {
- isExtendedType = true;
- } else {
- // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
- baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType);
- isExtendedType = true;
- }
- }
- if (UMLElementTypes.CommentAnnotatedElement_4008 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Deployment_4001 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DeploymentCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Manifestation_4002 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new ManifestationCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4004 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Dependency_4010 == baseElementType) {
- if (isExtendedType) {
- return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
- }
- return getGEFWrapper(new DependencyBranchCreateCommand(req,
- req.getSource(), req.getTarget()));
- }
- return null;
- }
-
- /**
- * Returns command to reorient EClass based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- switch (getVisualID(req)) {
- case DeploymentEditPart.VISUAL_ID:
- case ManifestationEditPart.VISUAL_ID:
- case DependencyEditPart.VISUAL_ID:
- case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
- /**
- * Returns command to reorient EReference based link. New link target or source
- * should be the domain model element associated with this node.
- *
- * @generated
- */
- @Override
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
- }
- return super.getReorientReferenceRelationshipCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicy.java
deleted file mode 100644
index 154564ba937..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicy.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.uml.diagram.deployment.edit.parts.CommentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedArtifactNodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedDeviceEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedExecutionEnvironmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedNodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramUpdater;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLNodeDescriptor;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class PackagePackageableElementCompartmentCanonicalEditPolicy extends CanonicalEditPolicy {
-
- /**
- * @generated
- */
- private Set<EStructuralFeature> myFeaturesToSynchronize;
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected Set<EStructuralFeature> getFeaturesToSynchronize() {
- if (myFeaturesToSynchronize == null) {
- myFeaturesToSynchronize = new HashSet<EStructuralFeature>();
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getPackage_PackagedElement());
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getElement_OwnedComment());
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getNamespace_OwnedRule());
- }
- return myFeaturesToSynchronize;
- }
-
- /**
- * @generated
- */
- @Override
- protected List<EObject> getSemanticChildrenList() {
- View viewObject = (View) getHost().getModel();
- LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
- .getPackagePackageableElementCompartment_38SemanticChildren(viewObject);
- for (UMLNodeDescriptor d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- }
-
- /**
- * @generated
- */
- @Override
- protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) {
- return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement());
- }
-
- /**
- * @generated
- */
- private boolean isMyDiagramElement(View view) {
- int visualID = UMLVisualIDRegistry.getVisualID(view);
- switch (visualID) {
- case ModelEditPartCN.VISUAL_ID:
- case PackageEditPartCN.VISUAL_ID:
- case NestedArtifactNodeEditPartCN.VISUAL_ID:
- case NestedDeviceEditPartCN.VISUAL_ID:
- case NestedExecutionEnvironmentEditPartCN.VISUAL_ID:
- case NestedNodeEditPartCN.VISUAL_ID:
- case CommentEditPartCN.VISUAL_ID:
- case ConstraintEditPartCN.VISUAL_ID:
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshSemantic() {
- if (resolveSemanticElement() == null) {
- return;
- }
- LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors =
- UMLDiagramUpdater.INSTANCE
- .getPackagePackageableElementCompartment_38SemanticChildren((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/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicyCN.java
deleted file mode 100644
index cd0ea599b77..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicyCN.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.uml.diagram.deployment.edit.parts.CommentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedArtifactNodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedDeviceEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedExecutionEnvironmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedNodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramUpdater;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLNodeDescriptor;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class PackagePackageableElementCompartmentCanonicalEditPolicyCN extends CanonicalEditPolicy {
-
- /**
- * @generated
- */
- private Set<EStructuralFeature> myFeaturesToSynchronize;
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected Set<EStructuralFeature> getFeaturesToSynchronize() {
- if (myFeaturesToSynchronize == null) {
- myFeaturesToSynchronize = new HashSet<EStructuralFeature>();
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getPackage_PackagedElement());
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getElement_OwnedComment());
- myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getNamespace_OwnedRule());
- }
- return myFeaturesToSynchronize;
- }
-
- /**
- * @generated
- */
- @Override
- protected List<EObject> getSemanticChildrenList() {
- View viewObject = (View) getHost().getModel();
- LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
- .getPackagePackageableElementCompartment_39SemanticChildren(viewObject);
- for (UMLNodeDescriptor d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- }
-
- /**
- * @generated
- */
- @Override
- protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) {
- return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement());
- }
-
- /**
- * @generated
- */
- private boolean isMyDiagramElement(View view) {
- int visualID = UMLVisualIDRegistry.getVisualID(view);
- switch (visualID) {
- case PackageEditPartCN.VISUAL_ID:
- case NestedArtifactNodeEditPartCN.VISUAL_ID:
- case NestedDeviceEditPartCN.VISUAL_ID:
- case NestedExecutionEnvironmentEditPartCN.VISUAL_ID:
- case NestedNodeEditPartCN.VISUAL_ID:
- case CommentEditPartCN.VISUAL_ID:
- case ConstraintEditPartCN.VISUAL_ID:
- return true;
- }
- return false;
- }
-
- /**
- * @generated
- */
- @Override
- protected void refreshSemantic() {
- if (resolveSemanticElement() == null) {
- return;
- }
- LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors =
- UMLDiagramUpdater.INSTANCE
- .getPackagePackageableElementCompartment_39SemanticChildren((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/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java
deleted file mode 100644
index 29f2ddc4361..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ModelCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.NestedArtifactNodeCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.NestedDeviceCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.NestedExecutionEnvironmentCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.NestedNodeCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.PackageCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class PackagePackageableElementCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public PackagePackageableElementCompartmentItemSemanticEditPolicy() {
- super(UMLElementTypes.Package_2009);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateCommand(CreateElementRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return super.getCreateCommand(req);
- }
-
-
- if (UMLElementTypes.Model_49 == requestElementType) {
-
- return getGEFWrapper(new ModelCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Package_36 == requestElementType) {
-
- return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Artifact_40 == requestElementType) {
-
- return getGEFWrapper(new NestedArtifactNodeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Device_44 == requestElementType) {
-
- return getGEFWrapper(new NestedDeviceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.ExecutionEnvironment_46 == requestElementType) {
-
- return getGEFWrapper(new NestedExecutionEnvironmentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Node_42 == requestElementType) {
-
- return getGEFWrapper(new NestedNodeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Comment_54 == requestElementType) {
-
- return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Constraint_56 == requestElementType) {
-
- return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- return super.getCreateCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicyCN.java
deleted file mode 100644
index 202aff4280b..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicyCN.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.NestedArtifactNodeCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.NestedDeviceCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.NestedExecutionEnvironmentCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.NestedNodeCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.PackageCreateCommandCN;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class PackagePackageableElementCompartmentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy {
-
- /**
- * @generated
- */
- public PackagePackageableElementCompartmentItemSemanticEditPolicyCN() {
- super(UMLElementTypes.Package_36);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getCreateCommand(CreateElementRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType == null) {
- return super.getCreateCommand(req);
- }
-
-
- if (UMLElementTypes.Package_36 == requestElementType) {
-
- return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Artifact_40 == requestElementType) {
-
- return getGEFWrapper(new NestedArtifactNodeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Device_44 == requestElementType) {
-
- return getGEFWrapper(new NestedDeviceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.ExecutionEnvironment_46 == requestElementType) {
-
- return getGEFWrapper(new NestedExecutionEnvironmentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Node_42 == requestElementType) {
-
- return getGEFWrapper(new NestedNodeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Comment_54 == requestElementType) {
-
- return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- if (UMLElementTypes.Constraint_56 == requestElementType) {
-
- return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
-
- }
- return super.getCreateCommand(req);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLBaseItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLBaseItemSemanticEditPolicy.java
index 611dab396dd..d02455d6f39 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLBaseItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLBaseItemSemanticEditPolicy.java
@@ -1,545 +1,543 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import java.util.Iterator;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.requests.ReconnectRequest;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
-import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.commands.MoveElementsCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.edit.helpers.GeneratedEditHelperBase;
-import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.uml2.uml.Artifact;
-import org.eclipse.uml2.uml.Classifier;
-import org.eclipse.uml2.uml.Comment;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.Dependency;
-import org.eclipse.uml2.uml.Deployment;
-import org.eclipse.uml2.uml.DeploymentTarget;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Generalization;
-import org.eclipse.uml2.uml.Manifestation;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Package;
-
-/**
- * @generated
- */
-public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
-
- /**
- * Extended request data key to hold editpart visual id.
- *
- * @generated
- */
- public static final String VISUAL_ID_KEY = "visual_id"; //$NON-NLS-1$
-
- /**
- * Extended request data key to hold the edge view during a reconnect request.
- *
- * @generated
- */
- public static final String GRAPHICAL_RECONNECTED_EDGE = "graphical_edge"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private final IElementType myElementType;
-
- /**
- * @generated
- */
- protected UMLBaseItemSemanticEditPolicy(IElementType elementType) {
- myElementType = elementType;
- }
-
- /**
- * Extended request data key to hold editpart visual id.
- * Add visual id of edited editpart to extended data of the request
- * so command switch can decide what kind of diagram element is being edited.
- * It is done in those cases when it's not possible to deduce diagram
- * element kind from domain element.
- * Add the reoriented view to the request extended data so that the view
- * currently edited can be distinguished from other views of the same element
- * and these latter possibly removed if they become inconsistent after reconnect
- *
- * @generated
- */
- @Override
- @SuppressWarnings("unchecked")
- public Command getCommand(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);
- }
- }
- return super.getCommand(request);
- }
-
- /**
- * 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;
- }
-
- /**
- * @generated
- */
- @Override
- 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 addDeleteViewCommand(Command mainCommand, DestroyRequest completedRequest) {
- Command deleteViewCommand = getGEFWrapper(new DeleteCommand(getEditingDomain(), (View) getHost().getModel()));
- return mainCommand == null ? deleteViewCommand : mainCommand.chain(deleteViewCommand);
- }
-
- /**
- * @generated
- */
- private Command getEditHelperCommand(IEditCommandRequest request, Command editPolicyCommand) {
- if (editPolicyCommand != null) {
- ICommand command = editPolicyCommand instanceof ICommandProxy ? ((ICommandProxy) editPolicyCommand).getICommand() : new CommandProxy(editPolicyCommand);
- request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, command);
- }
- IElementType requestContextElementType = getContextElementType(request);
- request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE, requestContextElementType);
- ICommand command = requestContextElementType.getEditCommand(request);
- request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, null);
- request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE, null);
- if (command != null) {
- if (!(command instanceof CompositeTransactionalCommand)) {
- command = new CompositeTransactionalCommand(getEditingDomain(), command.getLabel()).compose(command);
- }
- return new ICommandProxy(command);
- }
- return editPolicyCommand;
- }
-
- /**
- * @generated
- */
- protected IElementType getContextElementType(IEditCommandRequest request) {
- IElementType requestContextElementType = UMLElementTypes.getElementType(getVisualID(request));
- return requestContextElementType != null ? requestContextElementType : myElementType;
- }
-
- /**
- * @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 getConfigureCommand(ConfigureRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateCommand(CreateElementRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType instanceof IExtendedHintedElementType) {
- // try to get a semantic create command from the extended type
- IElementEditService commandProvider = ElementEditServiceUtils.getCommandProvider(req.getContainer());
- if (commandProvider != null) {
- ICommand command = commandProvider.getEditCommand(req);
- if (command != null && command.canExecute()) {
- return new ICommandProxy(command);
- }
- }
- }
- return null;
- }
-
- // RS: add code for extended types
- /**
- * @generated
- */
- protected Command getExtendedTypeCreationCommand(CreateElementRequest request, IExtendedHintedElementType requestElementType) {
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(request.getContainer());
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve create command from the Element Edit service
- ICommand createGMFCommand = provider.getEditCommand(request);
- return getGEFWrapper(createGMFCommand);
- }
-
- /**
- * @generated
- */
- protected Command getExtendedStartCreateRelationshipCommand(CreateElementRequest request, IExtendedHintedElementType requestElementType) {
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(requestElementType);
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve create command from the Element Edit service
- ICommand createGMFCommand = provider.getEditCommand(request);
- return getGEFWrapper(createGMFCommand);
- }
-
- /**
- * @generated
- */
- protected Command getExtendedCompleteCreateRelationshipCommand(CreateElementRequest request, IExtendedHintedElementType requestElementType) {
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(requestElementType);
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // Retrieve create command from the Element Edit service
- ICommand createGMFCommand = provider.getEditCommand(request);
- return getGEFWrapper(createGMFCommand);
- }
-
- // RS: End of add code for extended types
- /**
- * @generated
- */
- protected Command getSetCommand(SetRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getEditContextCommand(GetEditContextRequest 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 getMoveCommand(MoveRequest req) {
- EObject targetCEObject = req.getTargetContainer();
- if (targetCEObject != null) {
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(targetCEObject);
- if (provider != null) {
- ICommand moveCommand = provider.getEditCommand(req);
- if (moveCommand != null) {
- return new ICommandProxy(moveCommand);
- }
- }
- return UnexecutableCommand.INSTANCE;
- } else {
- return getGEFWrapper(new MoveElementsCommand(req));
- }
-
- }
-
- /**
- * @generated
- */
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- protected final Command getGEFWrapper(ICommand cmd) {
- return new ICommandProxy(cmd);
- }
-
- /**
- * Returns editing domain from the host edit part.
- *
- * @generated
- */
- protected TransactionalEditingDomain getEditingDomain() {
- return ((IGraphicalEditPart) getHost()).getEditingDomain();
- }
-
- /**
- * Clean all shortcuts to the host element from the same diagram
- *
- * @generated
- */
- protected void addDestroyShortcutsCommand(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));
- }
- }
-
- /**
- * @generated
- */
- public static LinkConstraints getLinkConstraints() {
- LinkConstraints cached = UMLDiagramEditorPlugin.getInstance().getLinkConstraints();
- if (cached == null) {
- UMLDiagramEditorPlugin.getInstance().setLinkConstraints(cached = new LinkConstraints());
- }
- return cached;
- }
-
- /**
- * @generated
- */
- public static class LinkConstraints {
-
- /**
- * @generated
- */
- public LinkConstraints() { // use static method #getLinkConstraints() to access instance
- }
-
- /**
- * @generated
- */
- public boolean canCreateLink_4005() {
- return canExistLink_4005();
- }
-
- /**
- * @generated
- */
- public boolean canCreateCommentAnnotatedElement_4008(Comment source, Element target) {
- if (source != null) {
- if (source.getAnnotatedElements()
- .contains(target)) {
- return false;
- }
- }
-
- return canExistCommentAnnotatedElement_4008(
- source, target);
- }
-
- /**
- * @generated
- */
- public boolean canCreateConstraintConstrainedElement_4009(Constraint source, Element target) {
- if (source != null) {
- if (source.getConstrainedElements()
- .contains(target)) {
- return false;
- }
- }
-
- return canExistConstraintConstrainedElement_4009(
- source, target);
- }
-
- /**
- * @generated
- */
- public boolean canCreateDeployment_4001(DeploymentTarget container, NamedElement source, NamedElement target) {
- return canExistDeployment_4001(
- container, null, source, target);
- }
-
- /**
- * @generated
- */
- public boolean canCreateManifestation_4002(Artifact container, NamedElement source, NamedElement target) {
- return canExistManifestation_4002(
- container, null, source, target);
- }
-
- /**
- * @generated
- */
- public boolean canCreateGeneralization_4003(Classifier container, Classifier source, Classifier target) {
- return canExistGeneralization_4003(
- container, null, source, target);
- }
-
- /**
- * @generated
- */
- public boolean canCreateDependency_4004(Package container, NamedElement source, NamedElement target) {
- return canExistDependency_4004(
- container, null, source, target);
- }
-
- /**
- * @generated
- */
- public boolean canCreateDependency_4010(Package container, NamedElement source, NamedElement target) {
- return canExistDependency_4010(
- container, null, source, target);
- }
-
- /**
- * @generated
- */
- public boolean canExistLink_4005() {
- return true;
- }
-
- /**
- * @generated
- */
- public boolean canExistCommentAnnotatedElement_4008(Comment source, Element target) {
- return true;
- }
-
- /**
- * @generated
- */
- public boolean canExistConstraintConstrainedElement_4009(Constraint source, Element target) {
- return true;
- }
-
- /**
- * @generated
- */
- public boolean canExistDeployment_4001(DeploymentTarget container, Deployment linkInstance, NamedElement source, NamedElement target) {
- return true;
- }
-
- /**
- * @generated
- */
- public boolean canExistManifestation_4002(Artifact container, Manifestation linkInstance, NamedElement source, NamedElement target) {
- return true;
- }
-
- /**
- * @generated
- */
- public boolean canExistGeneralization_4003(Classifier container, Generalization linkInstance, Classifier source, Classifier target) {
- return true;
- }
-
- /**
- * @generated
- */
- public boolean canExistDependency_4004(Package container, Dependency linkInstance, NamedElement source, NamedElement target) {
- return true;
- }
-
- /**
- * @generated
- */
- public boolean canExistDependency_4010(Package container, Dependency linkInstance, NamedElement source, NamedElement target) {
- return true;
- }
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.requests.ReconnectRequest;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
+import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.MoveElementsCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.helpers.GeneratedEditHelperBase;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Artifact;
+import org.eclipse.uml2.uml.Classifier;
+import org.eclipse.uml2.uml.Comment;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.Dependency;
+import org.eclipse.uml2.uml.Deployment;
+import org.eclipse.uml2.uml.DeploymentTarget;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Generalization;
+import org.eclipse.uml2.uml.Manifestation;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Package;
+
+/**
+ * @generated
+ */
+public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
+
+ /**
+ * Extended request data key to hold editpart visual id.
+ *
+ * @generated
+ */
+ public static final String VISUAL_ID_KEY = "visual_id"; //$NON-NLS-1$
+
+ /**
+ * Extended request data key to hold the edge view during a reconnect request.
+ *
+ * @generated
+ */
+ public static final String GRAPHICAL_RECONNECTED_EDGE = "graphical_edge"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private final IElementType myElementType;
+
+ /**
+ * @generated
+ */
+ protected UMLBaseItemSemanticEditPolicy(IElementType elementType) {
+ myElementType = elementType;
+ }
+
+ /**
+ * Extended request data key to hold editpart visual id.
+ * Add visual id of edited editpart to extended data of the request
+ * so command switch can decide what kind of diagram element is being edited.
+ * It is done in those cases when it's not possible to deduce diagram
+ * element kind from domain element.
+ * Add the reoriented view to the request extended data so that the view
+ * currently edited can be distinguished from other views of the same element
+ * and these latter possibly removed if they become inconsistent after reconnect
+ *
+ * @generated
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public Command getCommand(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);
+ }
+ }
+ return super.getCommand(request);
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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 addDeleteViewCommand(Command mainCommand, DestroyRequest completedRequest) {
+ Command deleteViewCommand = getGEFWrapper(new DeleteCommand(getEditingDomain(), (View) getHost().getModel()));
+ return mainCommand == null ? deleteViewCommand : mainCommand.chain(deleteViewCommand);
+ }
+
+ /**
+ * @generated
+ */
+ private Command getEditHelperCommand(IEditCommandRequest request, Command editPolicyCommand) {
+ if (editPolicyCommand != null) {
+ ICommand command = editPolicyCommand instanceof ICommandProxy ? ((ICommandProxy) editPolicyCommand).getICommand() : new CommandProxy(editPolicyCommand);
+ request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, command);
+ }
+ IElementType requestContextElementType = getContextElementType(request);
+ request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE, requestContextElementType);
+ ICommand command = requestContextElementType.getEditCommand(request);
+ request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, null);
+ request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE, null);
+ if (command != null) {
+ if (!(command instanceof CompositeTransactionalCommand)) {
+ command = new CompositeTransactionalCommand(getEditingDomain(), command.getLabel()).compose(command);
+ }
+ return new ICommandProxy(command);
+ }
+ return editPolicyCommand;
+ }
+
+ /**
+ * @generated
+ */
+ protected IElementType getContextElementType(IEditCommandRequest request) {
+ IElementType requestContextElementType = UMLElementTypes.getElementType(getVisualID(request));
+ return requestContextElementType != null ? requestContextElementType : myElementType;
+ }
+
+ /**
+ * @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 getConfigureCommand(ConfigureRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ IElementType requestElementType = req.getElementType();
+ if (requestElementType instanceof IElementType) {
+ IElementEditService commandProvider = ElementEditServiceUtils.getCommandProvider(req.getContainer());
+ if (commandProvider != null) {
+ ICommand command = commandProvider.getEditCommand(req);
+ if (command != null && command.canExecute()) {
+ return new ICommandProxy(command);
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getExtendedTypeCreationCommand(CreateElementRequest request, IElementType requestElementType) {
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(request.getContainer());
+ if (provider == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ // Retrieve create command from the Element Edit service
+ ICommand createGMFCommand = provider.getEditCommand(request);
+ return getGEFWrapper(createGMFCommand);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getExtendedStartCreateRelationshipCommand(CreateElementRequest request, IElementType requestElementType) {
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(requestElementType);
+ if (provider == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ // Retrieve create command from the Element Edit service
+ ICommand createGMFCommand = provider.getEditCommand(request);
+ return getGEFWrapper(createGMFCommand);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getExtendedCompleteCreateRelationshipCommand(CreateElementRequest request, IElementType requestElementType) {
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(requestElementType);
+ if (provider == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ // Retrieve create command from the Element Edit service
+ ICommand createGMFCommand = provider.getEditCommand(request);
+ return getGEFWrapper(createGMFCommand);
+ }
+
+ // RS: End of add code for extended types
+ /**
+ * @generated
+ */
+ protected Command getSetCommand(SetRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getEditContextCommand(GetEditContextRequest 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 getMoveCommand(MoveRequest req) {
+ EObject targetCEObject = req.getTargetContainer();
+ if (targetCEObject != null) {
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(targetCEObject);
+ if (provider != null) {
+ ICommand moveCommand = provider.getEditCommand(req);
+ if (moveCommand != null) {
+ return new ICommandProxy(moveCommand);
+ }
+ }
+ return UnexecutableCommand.INSTANCE;
+ } else {
+ return getGEFWrapper(new MoveElementsCommand(req));
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ protected final Command getGEFWrapper(ICommand cmd) {
+ return (cmd == null) ? UnexecutableCommand.INSTANCE : new ICommandProxy(cmd);
+ }
+
+ /**
+ * Returns editing domain from the host edit part.
+ *
+ * @generated
+ */
+ protected TransactionalEditingDomain getEditingDomain() {
+ return ((IGraphicalEditPart) getHost()).getEditingDomain();
+ }
+
+ /**
+ * Clean all shortcuts to the host element from the same diagram
+ *
+ * @generated
+ */
+ protected void addDestroyShortcutsCommand(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));
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static LinkConstraints getLinkConstraints() {
+ LinkConstraints cached = UMLDiagramEditorPlugin.getInstance().getLinkConstraints();
+ if (cached == null) {
+ UMLDiagramEditorPlugin.getInstance().setLinkConstraints(cached = new LinkConstraints());
+ }
+ return cached;
+ }
+
+ /**
+ * @generated
+ */
+ public static class LinkConstraints {
+
+ /**
+ * @generated
+ */
+ public LinkConstraints() { // use static method #getLinkConstraints() to access instance
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canCreateLink_4005() {
+ return canExistLink_4005();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canCreateCommentAnnotatedElement_4008(Comment source, Element target) {
+ if (source != null) {
+ if (source.getAnnotatedElements()
+ .contains(target)) {
+ return false;
+ }
+ }
+
+ return canExistCommentAnnotatedElement_4008(
+ source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canCreateConstraintConstrainedElement_4009(Constraint source, Element target) {
+ if (source != null) {
+ if (source.getConstrainedElements()
+ .contains(target)) {
+ return false;
+ }
+ }
+
+ return canExistConstraintConstrainedElement_4009(
+ source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canCreateDeployment_4001(DeploymentTarget container, NamedElement source, NamedElement target) {
+ return canExistDeployment_4001(
+ container, null, source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canCreateManifestation_4002(Artifact container, NamedElement source, NamedElement target) {
+ return canExistManifestation_4002(
+ container, null, source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canCreateGeneralization_4003(Classifier container, Classifier source, Classifier target) {
+ return canExistGeneralization_4003(
+ container, null, source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canCreateDependency_4004(Package container, NamedElement source, NamedElement target) {
+ return canExistDependency_4004(
+ container, null, source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canCreateDependency_4010(Package container, NamedElement source, NamedElement target) {
+ return canExistDependency_4010(
+ container, null, source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExistLink_4005() {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExistCommentAnnotatedElement_4008(Comment source, Element target) {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExistConstraintConstrainedElement_4009(Constraint source, Element target) {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExistDeployment_4001(DeploymentTarget container, Deployment linkInstance, NamedElement source, NamedElement target) {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExistManifestation_4002(Artifact container, Manifestation linkInstance, NamedElement source, NamedElement target) {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExistGeneralization_4003(Classifier container, Generalization linkInstance, Classifier source, Classifier target) {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExistDependency_4004(Package container, Dependency linkInstance, NamedElement source, NamedElement target) {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExistDependency_4010(Package container, Dependency linkInstance, NamedElement source, NamedElement target) {
+ return true;
+ }
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLTextNonResizableEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLTextNonResizableEditPolicy.java
index b90a4803e34..4b86a21db87 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLTextNonResizableEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLTextNonResizableEditPolicy.java
@@ -1,244 +1,243 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.FigureListener;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.handles.MoveHandle;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx;
-import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy;
-
-/**
- * @generated
- */
-public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx implements IRefreshableFeedbackEditPolicy {
-
- /**
- * @generated
- */
- private IFigure selectionFeedbackFigure;
-
- /**
- * @generated
- */
- private IFigure focusFeedbackFigure;
-
- /**
- * @generated
- */
- private FigureListener hostPositionListener;
-
- /**
- * @generated
- */
- @Override
- protected void showPrimarySelection() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setSelected(true);
- ((WrappingLabel) getHostFigure()).setFocus(true);
- } else {
- showSelection();
- showFocus();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void showSelection() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setSelected(true);
- ((WrappingLabel) getHostFigure()).setFocus(false);
- } else {
- hideSelection();
- addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
- getHostFigure().addFigureListener(getHostPositionListener());
- refreshSelectionFeedback();
- hideFocus();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void hideSelection() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setSelected(false);
- ((WrappingLabel) getHostFigure()).setFocus(false);
- } else {
- if (selectionFeedbackFigure != null) {
- removeFeedback(selectionFeedbackFigure);
- getHostFigure().removeFigureListener(getHostPositionListener());
- selectionFeedbackFigure = null;
- }
- hideFocus();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void showFocus() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setFocus(true);
- } else {
- hideFocus();
- addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
- refreshFocusFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void hideFocus() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setFocus(false);
- } else {
- if (focusFeedbackFigure != null) {
- removeFeedback(focusFeedbackFigure);
- focusFeedbackFigure = null;
- }
- }
- }
-
- /**
- * @generated
- */
- protected Rectangle getFeedbackBounds() {
- Rectangle bounds;
- if (getHostFigure() instanceof Label) {
- bounds = ((Label) getHostFigure()).getTextBounds();
- bounds.intersect(getHostFigure().getBounds());
- } else {
- bounds = getHostFigure().getBounds().getCopy();
- }
- getHostFigure().getParent().translateToAbsolute(bounds);
- getFeedbackLayer().translateToRelative(bounds);
- return bounds;
- }
-
- /**
- * @generated
- */
- protected IFigure createSelectionFeedbackFigure() {
- if (getHostFigure() instanceof Label) {
- 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 IFigure createFocusFeedbackFigure() {
- return new Figure() {
-
- @Override
- protected void paintFigure(Graphics graphics) {
- graphics.drawFocus(getBounds().getResized(-1, -1));
- }
- };
- }
-
- /**
- * @generated
- */
- protected void updateLabel(Label target) {
- Label source = (Label) getHostFigure();
- target.setText(source.getText());
- target.setTextAlignment(source.getTextAlignment());
- target.setFont(source.getFont());
- }
-
- /**
- * @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 refreshFocusFeedback() {
- if (focusFeedbackFigure != null) {
- focusFeedbackFigure.setBounds(getFeedbackBounds());
- }
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshFeedback() {
- refreshSelectionFeedback();
- refreshFocusFeedback();
- }
-
- /**
- * @generated
- */
- private FigureListener getHostPositionListener() {
- if (hostPositionListener == null) {
- hostPositionListener = new FigureListener() {
- @Override
- public void figureMoved(IFigure source) {
- refreshFeedback();
- }
- };
- }
- return hostPositionListener;
- }
-
- /**
- * @generated
- */
- @Override
- protected List<?> createSelectionHandles() {
- MoveHandle moveHandle =
- new MoveHandle((GraphicalEditPart) getHost());
- moveHandle.setBorder(null);
- moveHandle.setDragTracker(new DragEditPartsTrackerEx(getHost()));
- return Collections.singletonList(moveHandle);
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.FigureListener;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.handles.MoveHandle;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx;
+import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy;
+
+/**
+ * @generated
+ */
+public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx implements IRefreshableFeedbackEditPolicy {
+
+ /**
+ * @generated
+ */
+ private IFigure selectionFeedbackFigure;
+
+ /**
+ * @generated
+ */
+ private IFigure focusFeedbackFigure;
+
+ /**
+ * @generated
+ */
+ private FigureListener hostPositionListener;
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void showPrimarySelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(true);
+ ((WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ showSelection();
+ showFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void showSelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(true);
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ hideSelection();
+ addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
+ getHostFigure().addFigureListener(getHostPositionListener());
+ refreshSelectionFeedback();
+ hideFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void hideSelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(false);
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (selectionFeedbackFigure != null) {
+ removeFeedback(selectionFeedbackFigure);
+ getHostFigure().removeFigureListener(getHostPositionListener());
+ selectionFeedbackFigure = null;
+ }
+ hideFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void showFocus() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ hideFocus();
+ addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
+ refreshFocusFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void hideFocus() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (focusFeedbackFigure != null) {
+ removeFeedback(focusFeedbackFigure);
+ focusFeedbackFigure = null;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Rectangle getFeedbackBounds() {
+ Rectangle bounds;
+ if (getHostFigure() instanceof Label) {
+ bounds = ((Label) getHostFigure()).getTextBounds();
+ bounds.intersect(getHostFigure().getBounds());
+ } else {
+ bounds = getHostFigure().getBounds().getCopy();
+ }
+ getHostFigure().getParent().translateToAbsolute(bounds);
+ getFeedbackLayer().translateToRelative(bounds);
+ return bounds;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createSelectionFeedbackFigure() {
+ if (getHostFigure() instanceof Label) {
+ 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 IFigure createFocusFeedbackFigure() {
+ return new Figure() {
+
+ @Override
+ protected void paintFigure(Graphics graphics) {
+ graphics.drawFocus(getBounds().getResized(-1, -1));
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ protected void updateLabel(Label target) {
+ Label source = (Label) getHostFigure();
+ target.setText(source.getText());
+ target.setTextAlignment(source.getTextAlignment());
+ target.setFont(source.getFont());
+ }
+
+ /**
+ * @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 refreshFocusFeedback() {
+ if (focusFeedbackFigure != null) {
+ focusFeedbackFigure.setBounds(getFeedbackBounds());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void refreshFeedback() {
+ refreshSelectionFeedback();
+ refreshFocusFeedback();
+ }
+
+ /**
+ * @generated
+ */
+ private FigureListener getHostPositionListener() {
+ if (hostPositionListener == null) {
+ hostPositionListener = new FigureListener() {
+ @Override
+ public void figureMoved(IFigure source) {
+ refreshFeedback();
+ }
+ };
+ }
+ return hostPositionListener;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List<?> createSelectionHandles() {
+ MoveHandle moveHandle = new MoveHandle((GraphicalEditPart) getHost());
+ moveHandle.setBorder(null);
+ moveHandle.setDragTracker(new DragEditPartsTrackerEx(getHost()));
+ return Collections.singletonList(moveHandle);
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLTextSelectionEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLTextSelectionEditPolicy.java
index f33b8ff9e16..ee6174ff3d8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLTextSelectionEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLTextSelectionEditPolicy.java
@@ -1,226 +1,226 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.FigureListener;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.editpolicies.SelectionEditPolicy;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy;
-
-/**
- * @generated
- */
-public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements IRefreshableFeedbackEditPolicy {
-
- /**
- * @generated
- */
- private IFigure selectionFeedbackFigure;
-
- /**
- * @generated
- */
- private IFigure focusFeedbackFigure;
-
- /**
- * @generated
- */
- private FigureListener hostPositionListener;
-
- /**
- * @generated
- */
- @Override
- protected void showPrimarySelection() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setSelected(true);
- ((WrappingLabel) getHostFigure()).setFocus(true);
- } else {
- showSelection();
- showFocus();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void showSelection() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setSelected(true);
- ((WrappingLabel) getHostFigure()).setFocus(false);
- } else {
- hideSelection();
- addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
- getHostFigure().addFigureListener(getHostPositionListener());
- refreshSelectionFeedback();
- hideFocus();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void hideSelection() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setSelected(false);
- ((WrappingLabel) getHostFigure()).setFocus(false);
- } else {
- if (selectionFeedbackFigure != null) {
- removeFeedback(selectionFeedbackFigure);
- getHostFigure().removeFigureListener(getHostPositionListener());
- selectionFeedbackFigure = null;
- }
- hideFocus();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void showFocus() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setFocus(true);
- } else {
- hideFocus();
- addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
- refreshFocusFeedback();
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void hideFocus() {
- if (getHostFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getHostFigure()).setFocus(false);
- } else {
- if (focusFeedbackFigure != null) {
- removeFeedback(focusFeedbackFigure);
- focusFeedbackFigure = null;
- }
- }
- }
-
- /**
- * @generated
- */
- protected Rectangle getFeedbackBounds() {
- Rectangle bounds;
- if (getHostFigure() instanceof Label) {
- bounds = ((Label) getHostFigure()).getTextBounds();
- bounds.intersect(getHostFigure().getBounds());
- } else {
- bounds = getHostFigure().getBounds().getCopy();
- }
- getHostFigure().getParent().translateToAbsolute(bounds);
- getFeedbackLayer().translateToRelative(bounds);
- return bounds;
- }
-
- /**
- * @generated
- */
- protected IFigure createSelectionFeedbackFigure() {
- if (getHostFigure() instanceof Label) {
- 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 IFigure createFocusFeedbackFigure() {
- return new Figure() {
-
- @Override
- protected void paintFigure(Graphics graphics) {
- graphics.drawFocus(getBounds().getResized(-1, -1));
- }
- };
- }
-
- /**
- * @generated
- */
- protected void updateLabel(Label target) {
- Label source = (Label) getHostFigure();
- target.setText(source.getText());
- target.setTextAlignment(source.getTextAlignment());
- target.setFont(source.getFont());
- }
-
- /**
- * @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 refreshFocusFeedback() {
- if (focusFeedbackFigure != null) {
- focusFeedbackFigure.setBounds(getFeedbackBounds());
- }
- }
-
- /**
- * @generated
- */
- @Override
- public void refreshFeedback() {
- refreshSelectionFeedback();
- refreshFocusFeedback();
- }
-
- /**
- * @generated
- */
- private FigureListener getHostPositionListener() {
- if (hostPositionListener == null) {
- hostPositionListener = new FigureListener() {
- @Override
- public void figureMoved(IFigure source) {
- refreshFeedback();
- }
- };
- }
- return hostPositionListener;
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.edit.policies;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.FigureListener;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.editpolicies.SelectionEditPolicy;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy;
+
+/**
+ * @generated
+ */
+public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements IRefreshableFeedbackEditPolicy {
+
+ /**
+ * @generated
+ */
+ private IFigure selectionFeedbackFigure;
+
+ /**
+ * @generated
+ */
+ private IFigure focusFeedbackFigure;
+
+ /**
+ * @generated
+ */
+ private FigureListener hostPositionListener;
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void showPrimarySelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(true);
+ ((WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ showSelection();
+ showFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void showSelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(true);
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ hideSelection();
+ addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
+ getHostFigure().addFigureListener(getHostPositionListener());
+ refreshSelectionFeedback();
+ hideFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void hideSelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(false);
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (selectionFeedbackFigure != null) {
+ removeFeedback(selectionFeedbackFigure);
+ getHostFigure().removeFigureListener(getHostPositionListener());
+ selectionFeedbackFigure = null;
+ }
+ hideFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void showFocus() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ hideFocus();
+ addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
+ refreshFocusFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void hideFocus() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (focusFeedbackFigure != null) {
+ removeFeedback(focusFeedbackFigure);
+ focusFeedbackFigure = null;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Rectangle getFeedbackBounds() {
+ Rectangle bounds;
+ if (getHostFigure() instanceof Label) {
+ bounds = ((Label) getHostFigure()).getTextBounds();
+ bounds.intersect(getHostFigure().getBounds());
+ } else {
+ bounds = getHostFigure().getBounds().getCopy();
+ }
+ getHostFigure().getParent().translateToAbsolute(bounds);
+ getFeedbackLayer().translateToRelative(bounds);
+ return bounds;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createSelectionFeedbackFigure() {
+ if (getHostFigure() instanceof Label) {
+ 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 IFigure createFocusFeedbackFigure() {
+ return new Figure() {
+
+ @Override
+ protected void paintFigure(Graphics graphics) {
+ graphics.drawFocus(getBounds().getResized(-1, -1));
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ protected void updateLabel(Label target) {
+ Label source = (Label) getHostFigure();
+ target.setText(source.getText());
+ target.setTextAlignment(source.getTextAlignment());
+ target.setFont(source.getFont());
+ }
+
+ /**
+ * @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 refreshFocusFeedback() {
+ if (focusFeedbackFigure != null) {
+ focusFeedbackFigure.setBounds(getFeedbackBounds());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void refreshFeedback() {
+ refreshSelectionFeedback();
+ refreshFocusFeedback();
+ }
+
+ /**
+ * @generated
+ */
+ private FigureListener getHostPositionListener() {
+ if (hostPositionListener == null) {
+ hostPositionListener = new FigureListener() {
+ @Override
+ public void figureMoved(IFigure source) {
+ refreshFeedback();
+ }
+ };
+ }
+ return hostPositionListener;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/expressions/UMLAbstractExpression.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/expressions/UMLAbstractExpression.java
index 6613ba57157..07789f5857a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/expressions/UMLAbstractExpression.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/expressions/UMLAbstractExpression.java
@@ -1,170 +1,170 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.expressions;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.Collections;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EDataType;
-import org.eclipse.emf.ecore.EEnum;
-import org.eclipse.emf.ecore.EEnumLiteral;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public abstract class UMLAbstractExpression {
-
- /**
- * @generated
- */
- private IStatus status = Status.OK_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$
- }
- }
-
- /**
- * @generated
- */
- public IStatus getStatus() {
- return status;
- }
-
- /**
- * @generated
- */
- private final String myBody;
-
- /**
- * @generated
- */
- public String body() {
- return myBody;
- }
-
- /**
- * @generated
- */
- private final EClassifier myContext;
-
- /**
- * @generated
- */
- public EClassifier context() {
- return myContext;
- }
-
- /**
- * @generated
- */
- protected UMLAbstractExpression(String body, EClassifier context) {
- myBody = body;
- myContext = context;
- }
-
- /**
- * @generated
- */
- @SuppressWarnings("rawtypes")
- protected abstract Object doEvaluate(Object context, Map env);
-
- /**
- * @generated
- */
- public Object evaluate(Object context) {
- return evaluate(context, Collections.EMPTY_MAP);
- }
-
- /**
- * @generated
- */
- @SuppressWarnings("rawtypes")
- 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;
- }
-
- /**
- * 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;
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.expressions;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Collections;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EEnumLiteral;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+public abstract class UMLAbstractExpression {
+
+ /**
+ * @generated
+ */
+ private IStatus status = Status.OK_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$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public IStatus getStatus() {
+ return status;
+ }
+
+ /**
+ * @generated
+ */
+ private final String myBody;
+
+ /**
+ * @generated
+ */
+ public String body() {
+ return myBody;
+ }
+
+ /**
+ * @generated
+ */
+ private final EClassifier myContext;
+
+ /**
+ * @generated
+ */
+ public EClassifier context() {
+ return myContext;
+ }
+
+ /**
+ * @generated
+ */
+ protected UMLAbstractExpression(String body, EClassifier context) {
+ myBody = body;
+ myContext = context;
+ }
+
+ /**
+ * @generated
+ */
+ @SuppressWarnings("rawtypes")
+ protected abstract Object doEvaluate(Object context, Map env);
+
+ /**
+ * @generated
+ */
+ public Object evaluate(Object context) {
+ return evaluate(context, Collections.EMPTY_MAP);
+ }
+
+ /**
+ * @generated
+ */
+ @SuppressWarnings("rawtypes")
+ 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;
+ }
+
+ /**
+ * 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;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/expressions/UMLOCLFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/expressions/UMLOCLFactory.java
index 10e216810d9..932c1a24ab4 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/expressions/UMLOCLFactory.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/expressions/UMLOCLFactory.java
@@ -1,183 +1,184 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.expressions;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EParameter;
-import org.eclipse.emf.ecore.EcorePackage;
-import org.eclipse.ocl.Environment;
-import org.eclipse.ocl.EvaluationEnvironment;
-import org.eclipse.ocl.ParserException;
-import org.eclipse.ocl.ecore.EcoreFactory;
-import org.eclipse.ocl.ecore.OCL.Helper;
-import org.eclipse.ocl.ecore.OCLExpression;
-import org.eclipse.ocl.ecore.Variable;
-import org.eclipse.ocl.options.ParsingOptions;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class UMLOCLFactory {
-
- /**
- * @generated
- */
- private final UMLAbstractExpression[] expressions;
-
- /**
- * @generated
- */
- private final String[] expressionBodies;
-
- /**
- * @generated
- */
- protected UMLOCLFactory() {
- this.expressions = new UMLAbstractExpression[1];
- this.expressionBodies = new String[] { "self.name.concat(\'.file\') ", //$NON-NLS-1$
- };
- }
-
- /**
- * @generated
- */
- private static UMLOCLFactory getInstance() {
- UMLOCLFactory instance = UMLDiagramEditorPlugin.getInstance().getUMLOCLFactory();
- if (instance == null) {
- UMLDiagramEditorPlugin.getInstance().setUMLOCLFactory(instance = new UMLOCLFactory());
- }
- return instance;
- }
-
- /**
- * @generated
- */
- public static String getExpressionBody(int index) {
- return getInstance().expressionBodies[index];
- }
-
- /**
- * @generated
- */
- public static UMLAbstractExpression getExpression(int index, EClassifier context, Map<String, EClassifier> environment) {
- UMLOCLFactory cached = getInstance();
- if (index < 0 || index >= cached.expressions.length) {
- throw new IllegalArgumentException();
- }
- if (cached.expressions[index] == null) {
- cached.expressions[index] = getExpression(cached.expressionBodies[index], context, environment == null ? Collections.<String, EClassifier> emptyMap() : environment);
- }
- return cached.expressions[index];
- }
-
- /**
- * This is factory method, callers are responsible to keep reference to the return value if they want to reuse parsed expression
- *
- * @generated
- */
- public static UMLAbstractExpression getExpression(String body, EClassifier context, Map<String, EClassifier> environment) {
- return new Expression(body, context, environment);
- }
-
- /**
- * This method will become private in the next release
- *
- * @generated
- */
- public static UMLAbstractExpression getExpression(String body, EClassifier context) {
- return getExpression(body, context, Collections.<String, EClassifier> emptyMap());
- }
-
- /**
- * @generated
- */
- private static class Expression extends UMLAbstractExpression {
-
- /**
- * @generated
- */
- private final org.eclipse.ocl.ecore.OCL oclInstance;
-
- /**
- * @generated
- */
- private OCLExpression oclExpression;
-
- /**
- * @generated
- */
- public Expression(String body, EClassifier context, Map<String, EClassifier> environment) {
- super(body, context);
- oclInstance = org.eclipse.ocl.ecore.OCL.newInstance();
- initCustomEnv(oclInstance.getEnvironment(), environment);
- Helper oclHelper = oclInstance.createOCLHelper();
- oclHelper.setContext(context());
- try {
- oclExpression = oclHelper.createQuery(body());
- setStatus(IStatus.OK, null, null);
- } catch (ParserException e) {
- setStatus(IStatus.ERROR, e.getMessage(), e);
- }
- }
-
- /**
- * @generated
- */
- @Override
- @SuppressWarnings("rawtypes")
- protected Object doEvaluate(Object context, Map env) {
- if (oclExpression == null) {
- return null;
- }
- // on the first call, both evalEnvironment and extentMap are clear, for later we have finally, below.
- EvaluationEnvironment<?, ?, ?, ?, ?> evalEnv = oclInstance.getEvaluationEnvironment();
- // initialize environment
- for (Object nextKey : env.keySet()) {
- evalEnv.replace((String) nextKey, env.get(nextKey));
- }
- try {
- Object result = oclInstance.evaluate(context, oclExpression);
- return oclInstance.isInvalid(result) ? null : result;
- } finally {
- evalEnv.clear();
- oclInstance.setExtentMap(null); // clear allInstances cache, and get the oclInstance ready for the next call
- }
- }
-
- /**
- * @generated
- */
- private static void initCustomEnv(Environment<?, EClassifier, ?, ?, ?, EParameter, ?, ?, ?, ?, ?, ?> ecoreEnv, Map<String, EClassifier> environment) {
- // Use EObject as implicit root class for any object, to allow eContainer() and other EObject operations from OCL expressions
- ParsingOptions.setOption(ecoreEnv, ParsingOptions.implicitRootClass(ecoreEnv), EcorePackage.eINSTANCE.getEObject());
- for (String varName : environment.keySet()) {
- EClassifier varType = environment.get(varName);
- ecoreEnv.addElement(varName, createVar(ecoreEnv, varName, varType), false);
- }
- }
-
- /**
- * @generated
- */
- private static Variable createVar(Environment<?, EClassifier, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?> ecoreEnv, String name, EClassifier type) {
- Variable var = EcoreFactory.eINSTANCE.createVariable();
- var.setName(name);
- var.setType(ecoreEnv.getUMLReflection().getOCLType(type));
- return var;
- }
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.expressions;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EParameter;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.ocl.Environment;
+import org.eclipse.ocl.EvaluationEnvironment;
+import org.eclipse.ocl.ParserException;
+import org.eclipse.ocl.ecore.EcoreFactory;
+import org.eclipse.ocl.ecore.OCL.Helper;
+import org.eclipse.ocl.ecore.OCLExpression;
+import org.eclipse.ocl.ecore.Variable;
+import org.eclipse.ocl.options.ParsingOptions;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+public class UMLOCLFactory {
+
+ /**
+ * @generated
+ */
+ private final UMLAbstractExpression[] expressions;
+
+ /**
+ * @generated
+ */
+ private final String[] expressionBodies;
+
+ /**
+ * @generated
+ */
+ protected UMLOCLFactory() {
+ this.expressions = new UMLAbstractExpression[1];
+ this.expressionBodies = new String[] {
+ "self.name.concat(\'.file\') ", //$NON-NLS-1$
+ };
+ }
+
+ /**
+ * @generated
+ */
+ private static UMLOCLFactory getInstance() {
+ UMLOCLFactory instance = UMLDiagramEditorPlugin.getInstance().getUMLOCLFactory();
+ if (instance == null) {
+ UMLDiagramEditorPlugin.getInstance().setUMLOCLFactory(instance = new UMLOCLFactory());
+ }
+ return instance;
+ }
+
+ /**
+ * @generated
+ */
+ public static String getExpressionBody(int index) {
+ return getInstance().expressionBodies[index];
+ }
+
+ /**
+ * @generated
+ */
+ public static UMLAbstractExpression getExpression(int index, EClassifier context, Map<String, EClassifier> environment) {
+ UMLOCLFactory cached = getInstance();
+ if (index < 0 || index >= cached.expressions.length) {
+ throw new IllegalArgumentException();
+ }
+ if (cached.expressions[index] == null) {
+ cached.expressions[index] = getExpression(cached.expressionBodies[index], context, environment == null ? Collections.<String, EClassifier> emptyMap() : environment);
+ }
+ return cached.expressions[index];
+ }
+
+ /**
+ * This is factory method, callers are responsible to keep reference to the return value if they want to reuse parsed expression
+ *
+ * @generated
+ */
+ public static UMLAbstractExpression getExpression(String body, EClassifier context, Map<String, EClassifier> environment) {
+ return new Expression(body, context, environment);
+ }
+
+ /**
+ * This method will become private in the next release
+ *
+ * @generated
+ */
+ public static UMLAbstractExpression getExpression(String body, EClassifier context) {
+ return getExpression(body, context, Collections.<String, EClassifier> emptyMap());
+ }
+
+ /**
+ * @generated
+ */
+ private static class Expression extends UMLAbstractExpression {
+
+ /**
+ * @generated
+ */
+ private final org.eclipse.ocl.ecore.OCL oclInstance;
+
+ /**
+ * @generated
+ */
+ private OCLExpression oclExpression;
+
+ /**
+ * @generated
+ */
+ public Expression(String body, EClassifier context, Map<String, EClassifier> environment) {
+ super(body, context);
+ oclInstance = org.eclipse.ocl.ecore.OCL.newInstance();
+ initCustomEnv(oclInstance.getEnvironment(), environment);
+ Helper oclHelper = oclInstance.createOCLHelper();
+ oclHelper.setContext(context());
+ try {
+ oclExpression = oclHelper.createQuery(body());
+ setStatus(IStatus.OK, null, null);
+ } catch (ParserException e) {
+ setStatus(IStatus.ERROR, e.getMessage(), e);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ @SuppressWarnings("rawtypes")
+ protected Object doEvaluate(Object context, Map env) {
+ if (oclExpression == null) {
+ return null;
+ }
+ // on the first call, both evalEnvironment and extentMap are clear, for later we have finally, below.
+ EvaluationEnvironment<?, ?, ?, ?, ?> evalEnv = oclInstance.getEvaluationEnvironment();
+ // initialize environment
+ for (Object nextKey : env.keySet()) {
+ evalEnv.replace((String) nextKey, env.get(nextKey));
+ }
+ try {
+ Object result = oclInstance.evaluate(context, oclExpression);
+ return oclInstance.isInvalid(result) ? null : result;
+ } finally {
+ evalEnv.clear();
+ oclInstance.setExtentMap(null); // clear allInstances cache, and get the oclInstance ready for the next call
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static void initCustomEnv(Environment<?, EClassifier, ?, ?, ?, EParameter, ?, ?, ?, ?, ?, ?> ecoreEnv, Map<String, EClassifier> environment) {
+ // Use EObject as implicit root class for any object, to allow eContainer() and other EObject operations from OCL expressions
+ ParsingOptions.setOption(ecoreEnv, ParsingOptions.implicitRootClass(ecoreEnv), EcorePackage.eINSTANCE.getEObject());
+ for (String varName : environment.keySet()) {
+ EClassifier varType = environment.get(varName);
+ ecoreEnv.addElement(varName, createVar(ecoreEnv, varName, varType), false);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static Variable createVar(Environment<?, EClassifier, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?> ecoreEnv, String name, EClassifier type) {
+ Variable var = EcoreFactory.eINSTANCE.createVariable();
+ var.setName(name);
+ var.setType(ecoreEnv.getUMLReflection().getOCLType(type));
+ return var;
+ }
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/parsers/AbstractParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/parsers/AbstractParser.java
index a625f09edb5..cfeaa53d052 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/parsers/AbstractParser.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/parsers/AbstractParser.java
@@ -1 +1 @@
-// Since GMFT 3.1 we don't generate class AbstractParser into every diagram, instead extend org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser.
+// Since GMFT 3.1 we don't generate class AbstractParser into every diagram, instead extend org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser.
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/parsers/MessageFormatParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/parsers/MessageFormatParser.java
index 513310633da..b51f2a15553 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/parsers/MessageFormatParser.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/parsers/MessageFormatParser.java
@@ -1,212 +1,212 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.gmf.tooling.runtime.parsers.AbstractAttributeParser;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.uml.diagram.deployment.part.Messages;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class MessageFormatParser extends AbstractAttributeParser {
-
- /**
- * @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 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
- */
- @Override
- public void setViewPattern(String viewPattern) {
- super.setViewPattern(viewPattern);
- viewProcessor = null;
- }
-
- /**
- * @generated
- */
- @Override
- public void setEditorPattern(String editorPattern) {
- super.setEditorPattern(editorPattern);
- editorProcessor = null;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getViewProcessor() {
- if (viewProcessor == null) {
- viewProcessor = new MessageFormat(getViewPattern() == null ? getDefaultPattern() : getViewPattern());
- }
- return viewProcessor;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getEditorProcessor() {
- if (editorProcessor == null) {
- editorProcessor = new MessageFormat(getEditorPattern() == null ? getDefaultEditablePattern() : getEditorPattern());
- }
- return editorProcessor;
- }
-
- /**
- * @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
- */
- @Override
- public void setEditPattern(String editPattern) {
- super.setEditPattern(editPattern);
- editProcessor = null;
- }
-
- /**
- * @generated
- */
- protected MessageFormat getEditProcessor() {
- if (editProcessor == null) {
- editProcessor = new MessageFormat(getEditPattern() == null ? getDefaultEditablePattern() : getEditPattern());
- }
- return editProcessor;
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- 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
- */
- @Override
- public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) {
- Object[] values = getEditProcessor().parse(newString, new ParsePosition(0));
- return getParseCommand(adapter, values, flags);
- }
-
- /**
- * @generated
- */
- @Override
- 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();
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.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.gmf.tooling.runtime.parsers.AbstractAttributeParser;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.uml.diagram.deployment.part.Messages;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+public class MessageFormatParser extends AbstractAttributeParser {
+
+ /**
+ * @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 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
+ */
+ @Override
+ public void setViewPattern(String viewPattern) {
+ super.setViewPattern(viewPattern);
+ viewProcessor = null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void setEditorPattern(String editorPattern) {
+ super.setEditorPattern(editorPattern);
+ editorProcessor = null;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageFormat getViewProcessor() {
+ if (viewProcessor == null) {
+ viewProcessor = new MessageFormat(getViewPattern() == null ? getDefaultPattern() : getViewPattern());
+ }
+ return viewProcessor;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageFormat getEditorProcessor() {
+ if (editorProcessor == null) {
+ editorProcessor = new MessageFormat(getEditorPattern() == null ? getDefaultEditablePattern() : getEditorPattern());
+ }
+ return editorProcessor;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ public void setEditPattern(String editPattern) {
+ super.setEditPattern(editPattern);
+ editProcessor = null;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageFormat getEditProcessor() {
+ if (editProcessor == null) {
+ editProcessor = new MessageFormat(getEditPattern() == null ? getDefaultEditablePattern() : getEditPattern());
+ }
+ return editProcessor;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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
+ */
+ @Override
+ public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) {
+ Object[] values = getEditProcessor().parse(newString, new ParsePosition(0));
+ return getParseCommand(adapter, values, flags);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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();
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/DiagramEditorContextMenuProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/DiagramEditorContextMenuProvider.java
index d21b41f5972..a908f7fd923 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/DiagramEditorContextMenuProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/DiagramEditorContextMenuProvider.java
@@ -1,62 +1,62 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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
- */
- @Override
- public void buildContextMenu(final IMenuManager menu) {
- getViewer().flush();
- try {
- TransactionUtil.getEditingDomain(
- (EObject) getViewer().getContents().getModel()).runExclusive(new Runnable() {
-
- @Override
- 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);
- }
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.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
+ */
+ @Override
+ public void buildContextMenu(final IMenuManager menu) {
+ getViewer().flush();
+ try {
+ TransactionUtil.getEditingDomain(
+ (EObject) getViewer().getContents().getModel()).runExclusive(new Runnable() {
+
+ @Override
+ 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/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/LoadResourceAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/LoadResourceAction.java
index 27aecbdd9eb..ec5c44e63dd 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/LoadResourceAction.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/LoadResourceAction.java
@@ -1,30 +1,30 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.part;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.gmf.tooling.runtime.actions.DefaultLoadResourceAction;
-
-/**
- * @generated
- */
-public class LoadResourceAction extends DefaultLoadResourceAction {
-
- /**
- * @generated
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- return super.execute(event);
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.part;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.gmf.tooling.runtime.actions.DefaultLoadResourceAction;
+
+/**
+ * @generated
+ */
+public class LoadResourceAction extends DefaultLoadResourceAction {
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ return super.execute(event);
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/Messages.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/Messages.java
index b8a45d9e6b8..0e6a2f5ac3e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/Messages.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/Messages.java
@@ -1,499 +1,499 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.part;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * @generated
- */
-public class Messages extends NLS {
-
- /**
- * @generated
- */
- static {
- NLS.initializeMessages("messages", Messages.class); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- private Messages() {
- }
-
- /**
- * @generated
- */
- public static String UMLCreationWizardTitle;
-
- /**
- * @generated
- */
- public static String UMLCreationWizard_DiagramModelFilePageTitle;
-
- /**
- * @generated
- */
- public static String UMLCreationWizard_DiagramModelFilePageDescription;
-
- /**
- * @generated
- */
- public static String UMLCreationWizard_DomainModelFilePageTitle;
-
- /**
- * @generated
- */
- public static String UMLCreationWizard_DomainModelFilePageDescription;
-
- /**
- * @generated
- */
- public static String UMLCreationWizardOpenEditorError;
-
- /**
- * @generated
- */
- public static String UMLCreationWizardCreationError;
-
- /**
- * @generated
- */
- public static String UMLCreationWizardPageExtensionError;
-
- /**
- * @generated
- */
- public static String UMLDiagramEditorUtil_OpenModelResourceErrorDialogTitle;
-
- /**
- * @generated
- */
- public static String UMLDiagramEditorUtil_OpenModelResourceErrorDialogMessage;
-
- /**
- * @generated
- */
- public static String UMLDiagramEditorUtil_CreateDiagramProgressTask;
-
- /**
- * @generated
- */
- public static String UMLDiagramEditorUtil_CreateDiagramCommandLabel;
-
- /**
- * @generated
- */
- public static String UMLDocumentProvider_isModifiable;
-
- /**
- * @generated
- */
- public static String UMLDocumentProvider_handleElementContentChanged;
-
- /**
- * @generated
- */
- public static String UMLDocumentProvider_IncorrectInputError;
-
- /**
- * @generated
- */
- public static String UMLDocumentProvider_NoDiagramInResourceError;
-
- /**
- * @generated
- */
- public static String UMLDocumentProvider_DiagramLoadingError;
-
- /**
- * @generated
- */
- public static String UMLDocumentProvider_UnsynchronizedFileSaveError;
-
- /**
- * @generated
- */
- public static String UMLDocumentProvider_SaveDiagramTask;
-
- /**
- * @generated
- */
- public static String UMLDocumentProvider_SaveNextResourceTask;
-
- /**
- * @generated
- */
- public static String UMLDocumentProvider_SaveAsOperation;
-
- /**
- * @generated
- */
- public static String InitDiagramFile_ResourceErrorDialogTitle;
-
- /**
- * @generated
- */
- public static String InitDiagramFile_ResourceErrorDialogMessage;
-
- /**
- * @generated
- */
- public static String InitDiagramFile_WizardTitle;
-
- /**
- * @generated
- */
- public static String InitDiagramFile_OpenModelFileDialogTitle;
-
- /**
- * @generated
- */
- public static String UMLNewDiagramFileWizard_CreationPageName;
-
- /**
- * @generated
- */
- public static String UMLNewDiagramFileWizard_CreationPageTitle;
-
- /**
- * @generated
- */
- public static String UMLNewDiagramFileWizard_CreationPageDescription;
-
- /**
- * @generated
- */
- public static String UMLNewDiagramFileWizard_RootSelectionPageName;
-
- /**
- * @generated
- */
- public static String UMLNewDiagramFileWizard_RootSelectionPageTitle;
-
- /**
- * @generated
- */
- public static String UMLNewDiagramFileWizard_RootSelectionPageDescription;
-
- /**
- * @generated
- */
- public static String UMLNewDiagramFileWizard_RootSelectionPageSelectionTitle;
-
- /**
- * @generated
- */
- public static String UMLNewDiagramFileWizard_RootSelectionPageNoSelectionMessage;
-
- /**
- * @generated
- */
- public static String UMLNewDiagramFileWizard_RootSelectionPageInvalidSelectionMessage;
-
- /**
- * @generated
- */
- public static String UMLNewDiagramFileWizard_InitDiagramCommand;
-
- /**
- * @generated
- */
- public static String UMLNewDiagramFileWizard_IncorrectRootError;
-
- /**
- * @generated
- */
- public static String UMLDiagramEditor_SavingDeletedFile;
-
- /**
- * @generated
- */
- public static String UMLDiagramEditor_SaveAsErrorTitle;
-
- /**
- * @generated
- */
- public static String UMLDiagramEditor_SaveAsErrorMessage;
-
- /**
- * @generated
- */
- public static String UMLDiagramEditor_SaveErrorTitle;
-
- /**
- * @generated
- */
- public static String UMLDiagramEditor_SaveErrorMessage;
-
- /**
- * @generated
- */
- public static String UMLElementChooserDialog_SelectModelElementTitle;
-
- /**
- * @generated
- */
- public static String ModelElementSelectionPageMessage;
-
- /**
- * @generated
- */
- public static String ValidateActionMessage;
-
- /**
- * @generated
- */
- public static String NodesGroup_title;
-
- /**
- * @generated
- */
- public static String NodesGroup_desc;
-
- /**
- * @generated
- */
- public static String LinksGroup_title;
-
- /**
- * @generated
- */
- public static String LinksGroup_desc;
-
- /**
- * @generated
- */
- public static String ModelCreationTool_title;
-
- /**
- * @generated
- */
- public static String ModelCreationTool_desc;
-
- /**
- * @generated
- */
- public static String PackageCreationTool_title;
-
- /**
- * @generated
- */
- public static String PackageCreationTool_desc;
-
- /**
- * @generated
- */
- public static String NodeCreationTool_title;
-
- /**
- * @generated
- */
- public static String NodeCreationTool_desc;
-
- /**
- * @generated
- */
- public static String DeviceCreationTool_title;
-
- /**
- * @generated
- */
- public static String DeviceCreationTool_desc;
-
- /**
- * @generated
- */
- public static String ExecutionEnvironmentCreationTool_title;
-
- /**
- * @generated
- */
- public static String ExecutionEnvironmentCreationTool_desc;
-
- /**
- * @generated
- */
- public static String ArtifactCreationTool_title;
-
- /**
- * @generated
- */
- public static String ArtifactCreationTool_desc;
-
- /**
- * @generated
- */
- public static String CommentCreationTool_title;
-
- /**
- * @generated
- */
- public static String CommentCreationTool_desc;
-
- /**
- * @generated
- */
- public static String ConstraintCreationTool_title;
-
- /**
- * @generated
- */
- public static String ConstraintCreationTool_desc;
-
- /**
- * @generated
- */
- public static String LinkCreationTool_title;
-
- /**
- * @generated
- */
- public static String LinkCreationTool_desc;
-
- /**
- * @generated
- */
- public static String DependencyCreationTool_title;
-
- /**
- * @generated
- */
- public static String DependencyCreationTool_desc;
-
- /**
- * @generated
- */
- public static String DependencyBranchCreationTool_title;
-
- /**
- * @generated
- */
- public static String DependencyBranchCreationTool_desc;
-
- /**
- * @generated
- */
- public static String GeneralizationCreationTool_title;
-
- /**
- * @generated
- */
- public static String GeneralizationCreationTool_desc;
-
- /**
- * @generated
- */
- public static String DeploymentCreationTool_title;
-
- /**
- * @generated
- */
- public static String DeploymentCreationTool_desc;
-
- /**
- * @generated
- */
- public static String ManifestationCreationTool_title;
-
- /**
- * @generated
- */
- public static String ManifestationCreationTool_desc;
-
- /**
- * @generated
- */
- public static String ModelPackageableElementCompartmentEditPart_title;
-
- /**
- * @generated
- */
- public static String PackagePackageableElementCompartmentEditPart_title;
-
- /**
- * @generated
- */
- public static String DeviceCompositeCompartmentEditPart_title;
-
- /**
- * @generated
- */
- public static String ExecutionEnvironmentCompositeCompartmentEditPart_title;
-
- /**
- * @generated
- */
- public static String NodeCompositeCompartmentEditPart_title;
-
- /**
- * @generated
- */
- public static String ArtifactCompositeCompartmentEditPart_title;
-
- /**
- * @generated
- */
- public static String ModelPackageableElementCompartmentEditPartCN_title;
-
- /**
- * @generated
- */
- public static String PackagePackageableElementCompartmentEditPartCN_title;
-
- /**
- * @generated
- */
- public static String DeviceCompositeCompartmentEditPartCN_title;
-
- /**
- * @generated
- */
- public static String ExecutionEnvironmentCompositeCompartmentEditPartCN_title;
-
- /**
- * @generated
- */
- public static String NodeCompositeCompartmentEditPartCN_title;
-
- /**
- * @generated
- */
- public static String ArtifactCompositeCompartmentEditPartCN_title;
-
- /**
- * @generated
- */
- public static String ArtifactCompositeCompartmentEditPartACN_title;
-
- /**
- * @generated
- */
- public static String CommandName_OpenDiagram;
-
- /**
- * @generated
- */
- public static String MessageFormatParser_InvalidInputError;
-
- /**
- * @generated
- */
- public static String UMLModelingAssistantProviderTitle;
-
- /**
- * @generated
- */
- public static String UMLModelingAssistantProviderMessage;
- // TODO: put accessor fields manually
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.part;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @generated
+ */
+public class Messages extends NLS {
+
+ /**
+ * @generated
+ */
+ static {
+ NLS.initializeMessages("messages", Messages.class); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ private Messages() {
+ }
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizardTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizard_DiagramModelFilePageTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizard_DiagramModelFilePageDescription;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizard_DomainModelFilePageTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizard_DomainModelFilePageDescription;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizardOpenEditorError;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizardCreationError;
+
+ /**
+ * @generated
+ */
+ public static String UMLCreationWizardPageExtensionError;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditorUtil_OpenModelResourceErrorDialogTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditorUtil_OpenModelResourceErrorDialogMessage;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditorUtil_CreateDiagramProgressTask;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditorUtil_CreateDiagramCommandLabel;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_isModifiable;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_handleElementContentChanged;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_IncorrectInputError;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_NoDiagramInResourceError;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_DiagramLoadingError;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_UnsynchronizedFileSaveError;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_SaveDiagramTask;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_SaveNextResourceTask;
+
+ /**
+ * @generated
+ */
+ public static String UMLDocumentProvider_SaveAsOperation;
+
+ /**
+ * @generated
+ */
+ public static String InitDiagramFile_ResourceErrorDialogTitle;
+
+ /**
+ * @generated
+ */
+ public static String InitDiagramFile_ResourceErrorDialogMessage;
+
+ /**
+ * @generated
+ */
+ public static String InitDiagramFile_WizardTitle;
+
+ /**
+ * @generated
+ */
+ public static String InitDiagramFile_OpenModelFileDialogTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_CreationPageName;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_CreationPageTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_CreationPageDescription;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_RootSelectionPageName;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_RootSelectionPageTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_RootSelectionPageDescription;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_RootSelectionPageSelectionTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_RootSelectionPageNoSelectionMessage;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_RootSelectionPageInvalidSelectionMessage;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_InitDiagramCommand;
+
+ /**
+ * @generated
+ */
+ public static String UMLNewDiagramFileWizard_IncorrectRootError;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditor_SavingDeletedFile;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditor_SaveAsErrorTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditor_SaveAsErrorMessage;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditor_SaveErrorTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLDiagramEditor_SaveErrorMessage;
+
+ /**
+ * @generated
+ */
+ public static String UMLElementChooserDialog_SelectModelElementTitle;
+
+ /**
+ * @generated
+ */
+ public static String ModelElementSelectionPageMessage;
+
+ /**
+ * @generated
+ */
+ public static String ValidateActionMessage;
+
+ /**
+ * @generated
+ */
+ public static String NodesGroup_title;
+
+ /**
+ * @generated
+ */
+ public static String NodesGroup_desc;
+
+ /**
+ * @generated
+ */
+ public static String LinksGroup_title;
+
+ /**
+ * @generated
+ */
+ public static String LinksGroup_desc;
+
+ /**
+ * @generated
+ */
+ public static String ModelCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String ModelCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String PackageCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String PackageCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String NodeCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String NodeCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String DeviceCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String DeviceCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String ExecutionEnvironmentCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String ExecutionEnvironmentCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String ArtifactCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String ArtifactCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String CommentCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String CommentCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String ConstraintCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String ConstraintCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String LinkCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String LinkCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String DependencyCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String DependencyCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String DependencyBranchCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String DependencyBranchCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String GeneralizationCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String GeneralizationCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String DeploymentCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String DeploymentCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String ManifestationCreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String ManifestationCreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String ModelPackageableElementCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String PackagePackageableElementCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String DeviceCompositeCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String ExecutionEnvironmentCompositeCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String NodeCompositeCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String ArtifactCompositeCompartmentEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String ModelPackageableElementCompartmentEditPartCN_title;
+
+ /**
+ * @generated
+ */
+ public static String PackagePackageableElementCompartmentEditPartCN_title;
+
+ /**
+ * @generated
+ */
+ public static String DeviceCompositeCompartmentEditPartCN_title;
+
+ /**
+ * @generated
+ */
+ public static String ExecutionEnvironmentCompositeCompartmentEditPartCN_title;
+
+ /**
+ * @generated
+ */
+ public static String NodeCompositeCompartmentEditPartCN_title;
+
+ /**
+ * @generated
+ */
+ public static String ArtifactCompositeCompartmentEditPartCN_title;
+
+ /**
+ * @generated
+ */
+ public static String ArtifactCompositeCompartmentEditPartACN_title;
+
+ /**
+ * @generated
+ */
+ public static String CommandName_OpenDiagram;
+
+ /**
+ * @generated
+ */
+ public static String MessageFormatParser_InvalidInputError;
+
+ /**
+ * @generated
+ */
+ public static String UMLModelingAssistantProviderTitle;
+
+ /**
+ * @generated
+ */
+ public static String UMLModelingAssistantProviderMessage;
+ // TODO: put accessor fields manually
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/ModelElementSelectionPage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/ModelElementSelectionPage.java
index ceb88b2ccfb..c81fa8f9f26 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/ModelElementSelectionPage.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/ModelElementSelectionPage.java
@@ -1,39 +1,39 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.part;
-
-import org.eclipse.gmf.tooling.runtime.part.DefaultModelElementSelectionPage;
-
-/**
- * Wizard page that allows to select element from model.
- *
- * @generated
- */
-public class ModelElementSelectionPage extends DefaultModelElementSelectionPage {
-
- /**
- * @generated
- */
- public ModelElementSelectionPage(String pageName) {
- super(UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory(), pageName);
- }
-
- /**
- * Override to provide custom model element description.
- *
- * @generated
- */
- @Override
- protected String getSelectionTitle() {
- return Messages.ModelElementSelectionPageMessage;
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.part;
+
+import org.eclipse.gmf.tooling.runtime.part.DefaultModelElementSelectionPage;
+
+/**
+ * Wizard page that allows to select element from model.
+ *
+ * @generated
+ */
+public class ModelElementSelectionPage extends DefaultModelElementSelectionPage {
+
+ /**
+ * @generated
+ */
+ public ModelElementSelectionPage(String pageName) {
+ super(UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory(), pageName);
+ }
+
+ /**
+ * Override to provide custom model element description.
+ *
+ * @generated
+ */
+ @Override
+ protected String getSelectionTitle() {
+ return Messages.ModelElementSelectionPageMessage;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLCreationWizard.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLCreationWizard.java
index d9127727cc2..336a849f48f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLCreationWizard.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLCreationWizard.java
@@ -1,178 +1,181 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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 IWorkbench getWorkbench() {
- return workbench;
- }
-
- /**
- * @generated
- */
- public IStructuredSelection getSelection() {
- return selection;
- }
-
- /**
- * @generated
- */
- public final Resource getDiagram() {
- return diagram;
- }
-
- /**
- * @generated
- */
- public final boolean isOpenNewlyCreatedDiagramEditor() {
- return openNewlyCreatedDiagramEditor;
- }
-
- /**
- * @generated
- */
- public void setOpenNewlyCreatedDiagramEditor(boolean openNewlyCreatedDiagramEditor) {
- this.openNewlyCreatedDiagramEditor = openNewlyCreatedDiagramEditor;
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- public void addPages() {
- diagramModelFilePage = new UMLCreationWizardPage("DiagramModelFile", getSelection(), "PapyrusUMLDeployment_diagram"); //$NON-NLS-1$ //$NON-NLS-2$
- diagramModelFilePage.setTitle(Messages.UMLCreationWizard_DiagramModelFilePageTitle);
- diagramModelFilePage.setDescription(Messages.UMLCreationWizard_DiagramModelFilePageDescription);
- addPage(diagramModelFilePage);
-
- domainModelFilePage = new UMLCreationWizardPage("DomainModelFile", getSelection(), "umlDeployment") { //$NON-NLS-1$ //$NON-NLS-2$
-
- @Override
- public void setVisible(boolean visible) {
- if (visible) {
- String fileName = diagramModelFilePage.getFileName();
- fileName = fileName.substring(0, fileName.length() - ".PapyrusUMLDeployment_diagram".length()); //$NON-NLS-1$
- setFileName(UMLDiagramEditorUtil.getUniqueFileName(
- getContainerFullPath(), fileName, "umlDeployment")); //$NON-NLS-1$
- }
- super.setVisible(visible);
- }
- };
- domainModelFilePage.setTitle(Messages.UMLCreationWizard_DomainModelFilePageTitle);
- domainModelFilePage.setDescription(Messages.UMLCreationWizard_DomainModelFilePageDescription);
- addPage(domainModelFilePage);
- }
-
- /**
- * @generated
- */
- @Override
- public boolean performFinish() {
- IRunnableWithProgress op =
- new WorkspaceModifyOperation(null) {
-
- @Override
- 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;
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.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 IWorkbench getWorkbench() {
+ return workbench;
+ }
+
+ /**
+ * @generated
+ */
+ public IStructuredSelection getSelection() {
+ return selection;
+ }
+
+ /**
+ * @generated
+ */
+ public final Resource getDiagram() {
+ return diagram;
+ }
+
+ /**
+ * @generated
+ */
+ public final boolean isOpenNewlyCreatedDiagramEditor() {
+ return openNewlyCreatedDiagramEditor;
+ }
+
+ /**
+ * @generated
+ */
+ public void setOpenNewlyCreatedDiagramEditor(boolean openNewlyCreatedDiagramEditor) {
+ this.openNewlyCreatedDiagramEditor = openNewlyCreatedDiagramEditor;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ public void addPages() {
+ diagramModelFilePage = new UMLCreationWizardPage(
+ "DiagramModelFile", getSelection(), "PapyrusUMLDeployment_diagram"); //$NON-NLS-1$ //$NON-NLS-2$
+ diagramModelFilePage.setTitle(Messages.UMLCreationWizard_DiagramModelFilePageTitle);
+ diagramModelFilePage.setDescription(Messages.UMLCreationWizard_DiagramModelFilePageDescription);
+ addPage(diagramModelFilePage);
+
+ domainModelFilePage = new UMLCreationWizardPage(
+ "DomainModelFile", getSelection(), "umlDeployment") { //$NON-NLS-1$ //$NON-NLS-2$
+
+ @Override
+ public void setVisible(boolean visible) {
+ if (visible) {
+ String fileName = diagramModelFilePage.getFileName();
+ fileName = fileName.substring(0, fileName.length() - ".PapyrusUMLDeployment_diagram".length()); //$NON-NLS-1$
+ setFileName(UMLDiagramEditorUtil.getUniqueFileName(
+ getContainerFullPath(), fileName, "umlDeployment")); //$NON-NLS-1$
+ }
+ super.setVisible(visible);
+ }
+ };
+ domainModelFilePage.setTitle(Messages.UMLCreationWizard_DomainModelFilePageTitle);
+ domainModelFilePage.setDescription(Messages.UMLCreationWizard_DomainModelFilePageDescription);
+ addPage(domainModelFilePage);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean performFinish() {
+ IRunnableWithProgress op = new WorkspaceModifyOperation(null) {
+
+ @Override
+ 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;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLCreationWizardPage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLCreationWizardPage.java
index 923815d0069..cafc02a3a3e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLCreationWizardPage.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLCreationWizardPage.java
@@ -1,98 +1,98 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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;
- }
-
- /**
- * Override to create files with this extension.
- *
- * @generated
- */
- protected String getExtension() {
- return fileExtension;
- }
-
- /**
- * @generated
- */
- public URI getURI() {
- return URI.createPlatformResourceURI(getFilePath().toString(), false);
- }
-
- /**
- * @generated
- */
- protected IPath getFilePath() {
- IPath path = getContainerFullPath();
- if (path == null) {
- path = new Path(""); //$NON-NLS-1$
- }
- String fileName = getFileName();
- if (fileName != null) {
- path = path.append(fileName);
- }
- return path;
- }
-
- /**
- * @generated
- */
- @Override
- public void createControl(Composite parent) {
- super.createControl(parent);
- setFileName(UMLDiagramEditorUtil.getUniqueFileName(
- getContainerFullPath(), getFileName(), getExtension()));
- setPageComplete(validatePage());
- }
-
- /**
- * @generated
- */
- @Override
- 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;
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.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;
+ }
+
+ /**
+ * Override to create files with this extension.
+ *
+ * @generated
+ */
+ protected String getExtension() {
+ return fileExtension;
+ }
+
+ /**
+ * @generated
+ */
+ public URI getURI() {
+ return URI.createPlatformResourceURI(getFilePath().toString(), false);
+ }
+
+ /**
+ * @generated
+ */
+ protected IPath getFilePath() {
+ IPath path = getContainerFullPath();
+ if (path == null) {
+ path = new Path(""); //$NON-NLS-1$
+ }
+ String fileName = getFileName();
+ if (fileName != null) {
+ path = path.append(fileName);
+ }
+ return path;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void createControl(Composite parent) {
+ super.createControl(parent);
+ setFileName(UMLDiagramEditorUtil.getUniqueFileName(
+ getContainerFullPath(), getFileName(), getExtension()));
+ setPageComplete(validatePage());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramActionBarContributor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramActionBarContributor.java
index 28834d5608e..4c5613a1cbb 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramActionBarContributor.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramActionBarContributor.java
@@ -1,61 +1,61 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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
- */
- @Override
- protected Class<UMLDiagramEditor> getEditorClass() {
- return UMLDiagramEditor.class;
- }
-
- /**
- * @generated
- */
- @Override
- protected String getEditorId() {
- return UMLDiagramEditor.ID;
- }
-
- /**
- * @generated
- */
- @Override
- 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$
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.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
+ */
+ @Override
+ protected Class<UMLDiagramEditor> getEditorClass() {
+ return UMLDiagramEditor.class;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getEditorId() {
+ return UMLDiagramEditor.ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditor.java
index 4281d209393..78793e941b1 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditor.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditor.java
@@ -1,550 +1,549 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.part;
-
-import java.util.EventObject;
-
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.gef.KeyHandler;
-import org.eclipse.gef.Tool;
-import org.eclipse.gef.commands.CommandStackListener;
-import org.eclipse.gef.palette.PaletteRoot;
-import org.eclipse.gef.ui.palette.PaletteViewer;
-import org.eclipse.gef.ui.palette.PaletteViewerProvider;
-import org.eclipse.gmf.runtime.common.core.service.IProviderChangeListener;
-import org.eclipse.gmf.runtime.common.core.service.ProviderChangeEvent;
-import org.eclipse.gmf.runtime.common.ui.services.marker.MarkerNavigationService;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds;
-import org.eclipse.gmf.runtime.diagram.ui.internal.parts.PaletteToolTransferDragSourceListener;
-import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.util.LocalSelectionTransfer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.papyrus.commands.util.OperationHistoryDirtyState;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.gmfdiag.common.GmfMultiDiagramDocumentProvider;
-import org.eclipse.papyrus.uml.diagram.common.listeners.DropTargetListener;
-import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPaletteContextMenuProvider;
-import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPaletteViewer;
-import org.eclipse.papyrus.uml.diagram.common.part.UmlGmfDiagramEditor;
-import org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.ide.IGotoMarker;
-import org.eclipse.ui.part.ShowInContext;
-
-/**
- * @generated
- */
-public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderChangeListener, IGotoMarker {
-
- /**
- * @generated
- */
- public static final String ID = "org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorID"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final String CONTEXT_ID = "org.eclipse.papyrus.uml.diagram.deployment.ui.diagramContext"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private KeyHandler paletteKeyHandler = null;
-
- /**
- * @generated
- */
- private MouseListener paletteMouseListener = null;
-
- /**
- * @generated
- */
- private OperationHistoryDirtyState dirtyState;
-
- /**
- * @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
- */
- @Override
- protected String getContextID() {
- return CONTEXT_ID;
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- protected PreferencesHint getPreferencesHint() {
- return UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
- }
-
- /**
- * @generated
- */
- @Override
- public String getContributorId() {
- return UMLDiagramEditorPlugin.ID;
- }
-
- /**
- * @generated
- */
- @Override
- protected final IDocumentProvider getDocumentProvider(IEditorInput input) {
- return documentProvider;
- }
-
- /**
- * @generated
- */
- @Override
- public TransactionalEditingDomain getEditingDomain() {
- return editingDomain;
- }
-
- /**
- * @generated
- */
- @Override
- protected final void setDocumentProvider(IEditorInput input) {
- // Already set in the constructor
- }
-
- /**
- * @generated
- */
- @Override
- public void gotoMarker(IMarker marker) {
- MarkerNavigationService.getInstance().gotoMarker(this, marker);
- }
-
- /**
- * @generated
- */
- @Override
- public boolean isSaveAsAllowed() {
- return true;
- }
-
- /**
- * @generated
- */
- @Override
- public void doSaveAs() {
- performSaveAs(new NullProgressMonitor());
- }
-
- /**
- * @generated
- */
- @Override
- protected void performSaveAs(IProgressMonitor progressMonitor) {
- // Nothing
- }
-
- /**
- * @generated
- */
- @Override
- public ShowInContext getShowInContext() {
- return new ShowInContext(getEditorInput(), getGraphicalViewer().getSelection());
- }
-
- /**
- * @generated
- */
- @Override
- protected void configureGraphicalViewer() {
- super.configureGraphicalViewer();
- DiagramEditorContextMenuProvider provider =
- new DiagramEditorContextMenuProvider(this, getDiagramGraphicalViewer());
- getDiagramGraphicalViewer().setContextMenu(provider);
- getSite().registerContextMenu(ActionIds.DIAGRAM_EDITOR_CONTEXT_MENU, provider, getDiagramGraphicalViewer());
- }
-
- /**
- * @generated
- */
- @Override
- protected TransactionalEditingDomain createEditingDomain() {
- // Already configured
- return editingDomain;
- }
-
- /**
- * @generated
- */
- @Override
- protected void configureDiagramEditDomain() {
- super.configureDiagramEditDomain();
- getDiagramEditDomain().getDiagramCommandStack().addCommandStackListener(new CommandStackListener() {
-
- @Override
- public void commandStackChanged(EventObject event) {
- firePropertyChange(IEditorPart.PROP_DIRTY);
- }
- });
- }
-
- /**
- * @generated
- */
- @Override
- public void doSave(IProgressMonitor progressMonitor) {
- // The saving of the resource is done by the CoreMultiDiagramEditor
- getDirtyState().saved();
- }
-
- /**
- * @generated
- */
- protected OperationHistoryDirtyState getDirtyState() {
- if (dirtyState == null) {
- dirtyState = OperationHistoryDirtyState.newInstance(getUndoContext(), getOperationHistory());
- }
- return dirtyState;
- }
-
- /**
- * @generated
- */
- @Override
- protected void setUndoContext(IUndoContext context) {
- if (dirtyState != null) {
- dirtyState.dispose();
- dirtyState = null;
- }
-
- super.setUndoContext(context);
- }
-
- /**
- * @generated
- */
- @Override
- public boolean isDirty() {
- return getDirtyState().isDirty();
- }
-
- /**
- * @generated
- */
- @Override
- 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 dispose() {
- // remove palette service listener
- // remove preference listener
- PapyrusPaletteService.getInstance().removeProviderChangeListener(this);
-
- if (dirtyState != null) {
- dirtyState.dispose();
- dirtyState = null;
- }
-
- super.dispose();
- }
-
- /**
- * @generated
- */
- protected PaletteViewer getPaletteViewer() {
- return getEditDomain().getPaletteViewer();
- }
-
- /**
- * @generated
- */
- @Override
- protected PaletteViewer constructPaletteViewer() {
- return new PapyrusPaletteViewer();
- }
-
- /**
- * @generated
- */
- @Override
- protected PaletteViewerProvider createPaletteViewerProvider() {
- getEditDomain().setPaletteRoot(createPaletteRoot(null));
- return new PaletteViewerProvider(getEditDomain()) {
-
- /**
- * Override to provide the additional behavior for the tools. Will intialize with a
- * PaletteEditPartFactory that has a TrackDragger that understand how to handle the
- * mouseDoubleClick event for shape creation tools. Also will initialize the palette
- * with a defaultTool that is the SelectToolEx that undestands how to handle the enter
- * key which will result in the creation of the shape also.
- */
- @Override
- protected void configurePaletteViewer(PaletteViewer viewer) {
- super.configurePaletteViewer(viewer);
-
- // customize menu...
- viewer.setContextMenu(new PapyrusPaletteContextMenuProvider(viewer));
-
- viewer.getKeyHandler().setParent(getPaletteKeyHandler());
- viewer.getControl().addMouseListener(getPaletteMouseListener());
-
- // Add a transfer drag target listener that is supported on
- // palette template entries whose template is a creation tool.
- // This will enable drag and drop of the palette shape creation
- // tools.
- viewer.addDragSourceListener(new PaletteToolTransferDragSourceListener(viewer));
- viewer.setCustomizer(createPaletteCustomizer());
- }
-
- @Override
- public PaletteViewer createPaletteViewer(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
- */
- @Override
- 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)
- */
- @Override
- 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;
- }
- }
-
- @Override
- public void mouseDown(MouseEvent e) {
- // do nothing
- }
-
- @Override
- 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
- */
- @Override
- public GraphicalViewer getGraphicalViewer() {
- return super.getGraphicalViewer();
- }
-
- /**
- * @generated
- */
- @Override
- protected void initializeGraphicalViewer() {
- super.initializeGraphicalViewer();
-
- // Enable Drop
- getDiagramGraphicalViewer().addDropTargetListener(
- new DropTargetListener(getDiagramGraphicalViewer(), LocalSelectionTransfer.getTransfer()) {
-
- @Override
- protected Object getJavaObject(TransferData data) {
- // It is usual for the transfer data not to be set because it is available locally
- return LocalSelectionTransfer.getTransfer().getSelection();
- }
-
- @Override
- protected TransactionalEditingDomain getTransactionalEditingDomain() {
- return getEditingDomain();
- }
- });
-
- }
-
- /**
- * @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();
- }
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.part;
+
+import java.util.EventObject;
+
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.gef.KeyHandler;
+import org.eclipse.gef.Tool;
+import org.eclipse.gef.commands.CommandStackListener;
+import org.eclipse.gef.palette.PaletteRoot;
+import org.eclipse.gef.ui.palette.PaletteViewer;
+import org.eclipse.gef.ui.palette.PaletteViewerProvider;
+import org.eclipse.gmf.runtime.common.core.service.IProviderChangeListener;
+import org.eclipse.gmf.runtime.common.core.service.ProviderChangeEvent;
+import org.eclipse.gmf.runtime.common.ui.services.marker.MarkerNavigationService;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds;
+import org.eclipse.gmf.runtime.diagram.ui.internal.parts.PaletteToolTransferDragSourceListener;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.papyrus.commands.util.OperationHistoryDirtyState;
+import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.gmfdiag.common.GmfMultiDiagramDocumentProvider;
+import org.eclipse.papyrus.uml.diagram.common.listeners.DropTargetListener;
+import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPaletteContextMenuProvider;
+import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPaletteViewer;
+import org.eclipse.papyrus.uml.diagram.common.part.UmlGmfDiagramEditor;
+import org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.TransferData;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.ide.IGotoMarker;
+import org.eclipse.ui.part.ShowInContext;
+
+/**
+ * @generated
+ */
+public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderChangeListener, IGotoMarker {
+
+ /**
+ * @generated
+ */
+ public static final String ID = "org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorID"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final String CONTEXT_ID = "org.eclipse.papyrus.uml.diagram.deployment.ui.diagramContext"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private KeyHandler paletteKeyHandler = null;
+
+ /**
+ * @generated
+ */
+ private MouseListener paletteMouseListener = null;
+
+ /**
+ * @generated
+ */
+ private OperationHistoryDirtyState dirtyState;
+
+ /**
+ * @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
+ */
+ @Override
+ protected String getContextID() {
+ return CONTEXT_ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ protected PreferencesHint getPreferencesHint() {
+ return UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getContributorId() {
+ return UMLDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected final IDocumentProvider getDocumentProvider(IEditorInput input) {
+ return documentProvider;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public TransactionalEditingDomain getEditingDomain() {
+ return editingDomain;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected final void setDocumentProvider(IEditorInput input) {
+ // Already set in the constructor
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void gotoMarker(IMarker marker) {
+ MarkerNavigationService.getInstance().gotoMarker(this, marker);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean isSaveAsAllowed() {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void doSaveAs() {
+ performSaveAs(new NullProgressMonitor());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void performSaveAs(IProgressMonitor progressMonitor) {
+ // Nothing
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ShowInContext getShowInContext() {
+ return new ShowInContext(getEditorInput(), getGraphicalViewer().getSelection());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void configureGraphicalViewer() {
+ super.configureGraphicalViewer();
+ DiagramEditorContextMenuProvider provider = new DiagramEditorContextMenuProvider(this, getDiagramGraphicalViewer());
+ getDiagramGraphicalViewer().setContextMenu(provider);
+ getSite().registerContextMenu(ActionIds.DIAGRAM_EDITOR_CONTEXT_MENU, provider, getDiagramGraphicalViewer());
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected TransactionalEditingDomain createEditingDomain() {
+ // Already configured
+ return editingDomain;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void configureDiagramEditDomain() {
+ super.configureDiagramEditDomain();
+ getDiagramEditDomain().getDiagramCommandStack().addCommandStackListener(new CommandStackListener() {
+
+ @Override
+ public void commandStackChanged(EventObject event) {
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void doSave(IProgressMonitor progressMonitor) {
+ // The saving of the resource is done by the CoreMultiDiagramEditor
+ getDirtyState().saved();
+ }
+
+ /**
+ * @generated
+ */
+ protected OperationHistoryDirtyState getDirtyState() {
+ if (dirtyState == null) {
+ dirtyState = OperationHistoryDirtyState.newInstance(getUndoContext(), getOperationHistory());
+ }
+ return dirtyState;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void setUndoContext(IUndoContext context) {
+ if (dirtyState != null) {
+ dirtyState.dispose();
+ dirtyState = null;
+ }
+
+ super.setUndoContext(context);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean isDirty() {
+ return getDirtyState().isDirty();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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 dispose() {
+ // remove palette service listener
+ // remove preference listener
+ PapyrusPaletteService.getInstance().removeProviderChangeListener(this);
+
+ if (dirtyState != null) {
+ dirtyState.dispose();
+ dirtyState = null;
+ }
+
+ super.dispose();
+ }
+
+ /**
+ * @generated
+ */
+ protected PaletteViewer getPaletteViewer() {
+ return getEditDomain().getPaletteViewer();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected PaletteViewer constructPaletteViewer() {
+ return new PapyrusPaletteViewer();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected PaletteViewerProvider createPaletteViewerProvider() {
+ getEditDomain().setPaletteRoot(createPaletteRoot(null));
+ return new PaletteViewerProvider(getEditDomain()) {
+
+ /**
+ * Override to provide the additional behavior for the tools. Will intialize with a
+ * PaletteEditPartFactory that has a TrackDragger that understand how to handle the
+ * mouseDoubleClick event for shape creation tools. Also will initialize the palette
+ * with a defaultTool that is the SelectToolEx that undestands how to handle the enter
+ * key which will result in the creation of the shape also.
+ */
+ @Override
+ protected void configurePaletteViewer(PaletteViewer viewer) {
+ super.configurePaletteViewer(viewer);
+
+ // customize menu...
+ viewer.setContextMenu(new PapyrusPaletteContextMenuProvider(viewer));
+
+ viewer.getKeyHandler().setParent(getPaletteKeyHandler());
+ viewer.getControl().addMouseListener(getPaletteMouseListener());
+
+ // Add a transfer drag target listener that is supported on
+ // palette template entries whose template is a creation tool.
+ // This will enable drag and drop of the palette shape creation
+ // tools.
+ viewer.addDragSourceListener(new PaletteToolTransferDragSourceListener(viewer));
+ viewer.setCustomizer(createPaletteCustomizer());
+ }
+
+ @Override
+ public PaletteViewer createPaletteViewer(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
+ */
+ @Override
+ 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)
+ */
+ @Override
+ 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;
+ }
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+ // do nothing
+ }
+
+ @Override
+ 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
+ */
+ @Override
+ public GraphicalViewer getGraphicalViewer() {
+ return super.getGraphicalViewer();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void initializeGraphicalViewer() {
+ super.initializeGraphicalViewer();
+
+ // Enable Drop
+ getDiagramGraphicalViewer().addDropTargetListener(
+ new DropTargetListener(getDiagramGraphicalViewer(), LocalSelectionTransfer.getTransfer()) {
+
+ @Override
+ protected Object getJavaObject(TransferData data) {
+ // It is usual for the transfer data not to be set because it is available locally
+ return LocalSelectionTransfer.getTransfer().getSelection();
+ }
+
+ @Override
+ protected TransactionalEditingDomain getTransactionalEditingDomain() {
+ return getEditingDomain();
+ }
+ });
+
+ }
+
+ /**
+ * @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();
+ }
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditorPlugin.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditorPlugin.java
index 36cad0d14c0..eb0959d72d6 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditorPlugin.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditorPlugin.java
@@ -1,302 +1,301 @@
-/**
- * Copyright (c) 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the 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
- * Christian W. Damus (CEA) - bug 410346
- */
-package org.eclipse.papyrus.uml.diagram.deployment.part;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.infra.core.log.LogHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLBaseItemSemanticEditPolicy;
-import org.eclipse.papyrus.uml.diagram.deployment.expressions.UMLOCLFactory;
-import org.eclipse.papyrus.uml.diagram.deployment.preferences.DiagramPreferenceInitializer;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * @generated
- */
-public class UMLDiagramEditorPlugin extends AbstractUIPlugin {
-
- /**
- * @generated
- */
- public static final String ID = "org.eclipse.papyrus.uml.diagram.deployment"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private LogHelper myLogHelper;
-
- /**
- * @generated
- */
- public static final PreferencesHint DIAGRAM_PREFERENCES_HINT = new PreferencesHint(ID);
-
- /**
- * @generated
- */
- private static UMLDiagramEditorPlugin instance;
-
- /**
- * @generated
- */
- private AdapterFactory adapterFactory;
-
- /**
- * @generated
- */
- private UMLDocumentProvider documentProvider;
-
- /**
- * @generated
- */
- private UMLBaseItemSemanticEditPolicy.LinkConstraints linkConstraints;
-
- /**
- * @generated
- */
- private ElementInitializers initializers;
-
- /**
- * @generated
- */
- private UMLOCLFactory oclFactory;
-
- /**
- * @generated
- */
- public UMLDiagramEditorPlugin() {
- }
-
- /**
- * @generated
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- instance = this;
- myLogHelper = new LogHelper(this);
- PreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT, getPreferenceStore());
- adapterFactory = org.eclipse.papyrus.infra.gmfdiag.common.Activator.getInstance().getItemProvidersAdapterFactory();
- DiagramPreferenceInitializer diagramPreferenceInitializer = new DiagramPreferenceInitializer();
- diagramPreferenceInitializer.initializeDefaultPreferences();
-
- }
-
- /**
- * @generated
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- adapterFactory = null;
- linkConstraints = null;
- initializers = null;
- oclFactory = null;
- instance = null;
- super.stop(context);
- }
-
- /**
- * @generated
- */
- public static UMLDiagramEditorPlugin getInstance() {
- return instance;
- }
-
- /**
- * @generated
- */
- @Override
- public IPreferenceStore getPreferenceStore() {
- IPreferenceStore store = Activator.getDefault().getPreferenceStore();
- return store;
- }
-
- /**
- * @generated
- */
- public AdapterFactory getItemProvidersAdapterFactory() {
- return adapterFactory;
- }
-
- /**
- * @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;
- }
-
- /**
- * 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);
- }
-
- /**
- * 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 for the image file at the given plugin 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;
- }
-
- /**
- * 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
- */
- public UMLDocumentProvider getDocumentProvider() {
- if (documentProvider == null) {
- documentProvider = new UMLDocumentProvider();
- }
- return documentProvider;
- }
-
- /**
- * @generated
- */
- public UMLBaseItemSemanticEditPolicy.LinkConstraints getLinkConstraints() {
- return linkConstraints;
- }
-
- /**
- * @generated
- */
- public void setLinkConstraints(UMLBaseItemSemanticEditPolicy.LinkConstraints lc) {
- this.linkConstraints = lc;
- }
-
- /**
- * @generated
- */
- public ElementInitializers getElementInitializers() {
- return initializers;
- }
-
- /**
- * @generated
- */
- public void setElementInitializers(ElementInitializers i) {
- this.initializers = i;
- }
-
- /**
- * @generated
- */
- public UMLOCLFactory getUMLOCLFactory() {
- return oclFactory;
- }
-
- /**
- * @generated
- */
- public void setUMLOCLFactory(UMLOCLFactory f) {
- this.oclFactory = f;
- }
-
- /**
- * @generated
- */
- public void logError(String error) {
- getLogHelper().warn(error);
- }
-
- /**
- * @generated
- */
- public void logError(String error, Throwable throwable) {
- getLogHelper().error(error, throwable);
- }
-
- /**
- * @generated
- */
- public void logInfo(String message) {
- getLogHelper().info(message);
- }
-
- /**
- * @generated
- */
- public void logInfo(String message, Throwable throwable) {
- getLogHelper().error(message, throwable);
- }
-
- /**
- * @generated
- */
- public LogHelper getLogHelper() {
- return myLogHelper;
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the 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
+ * Christian W. Damus (CEA) - bug 410346
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.part;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLBaseItemSemanticEditPolicy;
+import org.eclipse.papyrus.uml.diagram.deployment.expressions.UMLOCLFactory;
+import org.eclipse.papyrus.uml.diagram.deployment.preferences.DiagramPreferenceInitializer;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.ElementInitializers;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * @generated
+ */
+public class UMLDiagramEditorPlugin extends AbstractUIPlugin {
+
+ /**
+ * @generated
+ */
+ public static final String ID = "org.eclipse.papyrus.uml.diagram.deployment"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private LogHelper myLogHelper;
+
+ /**
+ * @generated
+ */
+ public static final PreferencesHint DIAGRAM_PREFERENCES_HINT = new PreferencesHint(ID);
+
+ /**
+ * @generated
+ */
+ private static UMLDiagramEditorPlugin instance;
+
+ /**
+ * @generated
+ */
+ private AdapterFactory adapterFactory;
+
+ /**
+ * @generated
+ */
+ private UMLDocumentProvider documentProvider;
+
+ /**
+ * @generated
+ */
+ private UMLBaseItemSemanticEditPolicy.LinkConstraints linkConstraints;
+
+ /**
+ * @generated
+ */
+ private ElementInitializers initializers;
+
+ /**
+ * @generated
+ */
+ private UMLOCLFactory oclFactory;
+
+ /**
+ * @generated
+ */
+ public UMLDiagramEditorPlugin() {
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ instance = this;
+ myLogHelper = new LogHelper(this);
+ PreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT, getPreferenceStore());
+ adapterFactory = org.eclipse.papyrus.infra.gmfdiag.common.Activator.getInstance().getItemProvidersAdapterFactory();
+ DiagramPreferenceInitializer diagramPreferenceInitializer = new DiagramPreferenceInitializer();
+ diagramPreferenceInitializer.initializeDefaultPreferences();
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ adapterFactory = null;
+ linkConstraints = null;
+ initializers = null;
+ oclFactory = null;
+ instance = null;
+ super.stop(context);
+ }
+
+ /**
+ * @generated
+ */
+ public static UMLDiagramEditorPlugin getInstance() {
+ return instance;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IPreferenceStore getPreferenceStore() {
+ IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+ return store;
+ }
+
+ /**
+ * @generated
+ */
+ public AdapterFactory getItemProvidersAdapterFactory() {
+ return adapterFactory;
+ }
+
+ /**
+ * @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;
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * 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 for the image file at the given plugin 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;
+ }
+
+ /**
+ * 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
+ */
+ public UMLDocumentProvider getDocumentProvider() {
+ if (documentProvider == null) {
+ documentProvider = new UMLDocumentProvider();
+ }
+ return documentProvider;
+ }
+
+ /**
+ * @generated
+ */
+ public UMLBaseItemSemanticEditPolicy.LinkConstraints getLinkConstraints() {
+ return linkConstraints;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLinkConstraints(UMLBaseItemSemanticEditPolicy.LinkConstraints lc) {
+ this.linkConstraints = lc;
+ }
+
+ /**
+ * @generated
+ */
+ public ElementInitializers getElementInitializers() {
+ return initializers;
+ }
+
+ /**
+ * @generated
+ */
+ public void setElementInitializers(ElementInitializers i) {
+ this.initializers = i;
+ }
+
+ /**
+ * @generated
+ */
+ public UMLOCLFactory getUMLOCLFactory() {
+ return oclFactory;
+ }
+
+ /**
+ * @generated
+ */
+ public void setUMLOCLFactory(UMLOCLFactory f) {
+ this.oclFactory = f;
+ }
+
+ /**
+ * @generated
+ */
+ public void logError(String error) {
+ getLogHelper().warn(error);
+ }
+
+ /**
+ * @generated
+ */
+ public void logError(String error, Throwable throwable) {
+ getLogHelper().error(error, throwable);
+ }
+
+ /**
+ * @generated
+ */
+ public void logInfo(String message) {
+ getLogHelper().info(message);
+ }
+
+ /**
+ * @generated
+ */
+ public void logInfo(String message, Throwable throwable) {
+ getLogHelper().error(message, throwable);
+ }
+
+ /**
+ * @generated
+ */
+ public LogHelper getLogHelper() {
+ return myLogHelper;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditorUtil.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditorUtil.java
index 3e7ade10033..3b04794dbf7 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditorUtil.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditorUtil.java
@@ -1,362 +1,360 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.part;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.xmi.XMLResource;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
-import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer;
-import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.part.DefaultDiagramEditorUtil;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart;
-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 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 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;
- }
-
- /**
- * @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$
- }
- }
-
- /**
- * @generated
- */
- public static String getUniqueFileName(IPath containerFullPath, String fileName, String extension) {
- return DefaultDiagramEditorUtil.getUniqueFileName(containerFullPath, fileName, extension,
- DefaultDiagramEditorUtil.EXISTS_IN_WORKSPACE);
- }
-
- /**
- * 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();
- }
-
- /**
- * 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 = WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain();
- progressMonitor.beginTask(Messages.UMLDiagramEditorUtil_CreateDiagramProgressTask, 3);
- final Resource diagramResource = editingDomain.getResourceSet().createResource(diagramURI);
- final Resource modelResource = editingDomain.getResourceSet().createResource(modelURI);
- final String diagramName = diagramURI.lastSegment();
- AbstractTransactionalCommand command = new AbstractTransactionalCommand(editingDomain, Messages.UMLDiagramEditorUtil_CreateDiagramCommandLabel, Collections.EMPTY_LIST) {
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- Package model = createInitialModel();
- attachModelToResource(model, modelResource);
-
- Diagram diagram = ViewService.createDiagram(
- model,
- DeploymentDiagramEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
- if (diagram != null) {
- diagramResource.getContents().add(diagram);
- diagram.setName(diagramName);
- diagram.setElement(model);
- }
-
- try {
- modelResource.save(org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorUtil.getSaveOptions());
- diagramResource.save(org.eclipse.papyrus.uml.diagram.deployment.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();
- }
-
- /**
- * 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);
- }
-
- /**
- * @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
- */
- 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;
- }
-
- /**
- * XXX This is quite suspicious code (especially editPartTmpHolder) and likely to be removed soon
- *
- * @generated
- */
- public static class LazyElement2ViewMap {
-
- /**
- * @generated
- */
- private Map<EObject, View> element2ViewMap;
-
- /**
- * @generated
- */
- private 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;
- }
-
- /**
- * @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;
- }
- } // LazyElement2ViewMap
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.part;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.OperationHistoryFactory;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.xmi.XMLResource;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.part.DefaultDiagramEditorUtil;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart;
+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 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 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;
+ }
+
+ /**
+ * @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$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static String getUniqueFileName(IPath containerFullPath, String fileName, String extension) {
+ return DefaultDiagramEditorUtil.getUniqueFileName(containerFullPath, fileName, extension,
+ DefaultDiagramEditorUtil.EXISTS_IN_WORKSPACE);
+ }
+
+ /**
+ * 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();
+ }
+
+ /**
+ * 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 = WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain();
+ progressMonitor.beginTask(Messages.UMLDiagramEditorUtil_CreateDiagramProgressTask, 3);
+ final Resource diagramResource = editingDomain.getResourceSet().createResource(diagramURI);
+ final Resource modelResource = editingDomain.getResourceSet().createResource(modelURI);
+ final String diagramName = diagramURI.lastSegment();
+ AbstractTransactionalCommand command = new AbstractTransactionalCommand(editingDomain, Messages.UMLDiagramEditorUtil_CreateDiagramCommandLabel, Collections.EMPTY_LIST) {
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ Package model = createInitialModel();
+ attachModelToResource(model, modelResource);
+
+ Diagram diagram = ViewService.createDiagram(
+ model,
+ DeploymentDiagramEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+ if (diagram != null) {
+ diagramResource.getContents().add(diagram);
+ diagram.setName(diagramName);
+ diagram.setElement(model);
+ }
+
+ try {
+ modelResource.save(org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorUtil.getSaveOptions());
+ diagramResource.save(org.eclipse.papyrus.uml.diagram.deployment.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();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * @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
+ */
+ 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;
+ }
+
+ /**
+ * XXX This is quite suspicious code (especially editPartTmpHolder) and likely to be removed soon
+ *
+ * @generated
+ */
+ public static class LazyElement2ViewMap {
+
+ /**
+ * @generated
+ */
+ private Map<EObject, View> element2ViewMap;
+
+ /**
+ * @generated
+ */
+ private 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;
+ }
+
+ /**
+ * @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;
+ }
+ } // LazyElement2ViewMap
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramUpdater.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramUpdater.java
index 564722f3461..ec4462bc151 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramUpdater.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramUpdater.java
@@ -1,2929 +1,2603 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.part;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.emf.core.util.CrossReferenceAdapter;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.update.DiagramUpdater;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactCompositeCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactCompositeCompartmentEditPartACN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactCompositeCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPartACN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DefaultNamedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNodeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceCompositeCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceCompositeCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentCompositeCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentCompositeCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelPackageableElementCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelPackageableElementCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedArtifactNodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedDeviceEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedExecutionEnvironmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedNodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeCompositeCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeCompositeCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackagePackageableElementCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackagePackageableElementCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.uml2.uml.Artifact;
-import org.eclipse.uml2.uml.Classifier;
-import org.eclipse.uml2.uml.Comment;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.Dependency;
-import org.eclipse.uml2.uml.Deployment;
-import org.eclipse.uml2.uml.DeploymentTarget;
-import org.eclipse.uml2.uml.Device;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.ExecutionEnvironment;
-import org.eclipse.uml2.uml.Generalization;
-import org.eclipse.uml2.uml.Manifestation;
-import org.eclipse.uml2.uml.Model;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Node;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.PackageableElement;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class UMLDiagramUpdater implements DiagramUpdater {
-
- /**
- * @generated
- */
- public static final org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramUpdater INSTANCE = new UMLDiagramUpdater();
-
- /**
- * @generated
- */
- protected UMLDiagramUpdater() {
- // to prevent instantiation allowing the override
- }
-
- /**
- * @generated
- */
- @Override
- public List<UMLNodeDescriptor> getSemanticChildren(View view) {
- switch (UMLVisualIDRegistry.getVisualID(view)) {
- case DeploymentDiagramEditPart.VISUAL_ID:
- return getPackage_1000SemanticChildren(view);
- case ModelPackageableElementCompartmentEditPart.VISUAL_ID:
- return getModelModelCompartment_51SemanticChildren(view);
- case PackagePackageableElementCompartmentEditPart.VISUAL_ID:
- return getPackagePackageableElementCompartment_38SemanticChildren(view);
- case DeviceCompositeCompartmentEditPart.VISUAL_ID:
- return getDeviceDeviceCompositeCompartment_17SemanticChildren(view);
- case ExecutionEnvironmentCompositeCompartmentEditPart.VISUAL_ID:
- return getExecutionEnvironmentExecutionEnvironmentCompositeCompartment_18SemanticChildren(view);
- case NodeCompositeCompartmentEditPart.VISUAL_ID:
- return getNodeCompositeCompartment_19SemanticChildren(view);
- case ArtifactCompositeCompartmentEditPart.VISUAL_ID:
- return getArtifactArtifactCompositeCompartment_26SemanticChildren(view);
- case ModelPackageableElementCompartmentEditPartCN.VISUAL_ID:
- return getModelModelCompartment_52SemanticChildren(view);
- case PackagePackageableElementCompartmentEditPartCN.VISUAL_ID:
- return getPackagePackageableElementCompartment_39SemanticChildren(view);
- case DeviceCompositeCompartmentEditPartCN.VISUAL_ID:
- return getDeviceDeviceCompositeCompartment_30SemanticChildren(view);
- case ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID:
- return getExecutionEnvironmentExecutionEnvironmentCompositeCompartment_31SemanticChildren(view);
- case NodeCompositeCompartmentEditPartCN.VISUAL_ID:
- return getNodeCompositeCompartment_32SemanticChildren(view);
- case ArtifactCompositeCompartmentEditPartCN.VISUAL_ID:
- return getArtifactArtifactCompositeCompartment_33SemanticChildren(view);
- case ArtifactCompositeCompartmentEditPartACN.VISUAL_ID:
- return getArtifactArtifactCompositeCompartment_34SemanticChildren(view);
- }
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public List<UMLNodeDescriptor> getPackage_1000SemanticChildren(View view) {
- if (!view.isSetElement()) {
- return Collections.emptyList();
- }
- 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 == DependencyNodeEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == ModelEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == PackageEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == ExecutionEnvironmentEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == DeviceEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == ArtifactEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == NodeEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == DefaultNamedElementEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- for (Iterator<?> it = modelElement.getOwnedRules()
- .iterator(); it.hasNext();) {
- Constraint childElement = (Constraint) it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == ConstraintEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- for (Iterator<?> it = modelElement.getOwnedComments()
- .iterator(); it.hasNext();) {
- Comment childElement = (Comment) it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == CommentEditPart.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLNodeDescriptor> getModelModelCompartment_51SemanticChildren(View view) {
- if (false == view.eContainer() instanceof View) {
- return Collections.emptyList();
- }
- View containerView = (View) view.eContainer();
- if (!containerView.isSetElement()) {
- return Collections.emptyList();
- }
- Model modelElement = (Model) containerView.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 == ModelEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == PackageEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == NestedDeviceEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == NestedExecutionEnvironmentEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == NestedNodeEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == NestedArtifactNodeEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- for (Iterator<?> it = modelElement.getOwnedComments()
- .iterator(); it.hasNext();) {
- Comment childElement = (Comment) it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == CommentEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- for (Iterator<?> it = modelElement.getOwnedRules()
- .iterator(); it.hasNext();) {
- Constraint childElement = (Constraint) it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == ConstraintEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLNodeDescriptor> getPackagePackageableElementCompartment_38SemanticChildren(View view) {
- if (false == view.eContainer() instanceof View) {
- return Collections.emptyList();
- }
- View containerView = (View) view.eContainer();
- if (!containerView.isSetElement()) {
- return Collections.emptyList();
- }
- Package modelElement = (Package) containerView.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 == ModelEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == PackageEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == NestedArtifactNodeEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == NestedDeviceEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == NestedExecutionEnvironmentEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == NestedNodeEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- for (Iterator<?> it = modelElement.getOwnedComments()
- .iterator(); it.hasNext();) {
- Comment childElement = (Comment) it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == CommentEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- for (Iterator<?> it = modelElement.getOwnedRules()
- .iterator(); it.hasNext();) {
- Constraint childElement = (Constraint) it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == ConstraintEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLNodeDescriptor> getDeviceDeviceCompositeCompartment_17SemanticChildren(View view) {
- if (false == view.eContainer() instanceof View) {
- return Collections.emptyList();
- }
- View containerView = (View) view.eContainer();
- if (!containerView.isSetElement()) {
- return Collections.emptyList();
- }
- Device modelElement = (Device) containerView.getElement();
- LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for (Iterator<?> it = modelElement.getNestedNodes()
- .iterator(); it.hasNext();) {
- Node childElement = (Node) it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == ExecutionEnvironmentEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == DeviceEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == NodeEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLNodeDescriptor> getExecutionEnvironmentExecutionEnvironmentCompositeCompartment_18SemanticChildren(View view) {
- if (false == view.eContainer() instanceof View) {
- return Collections.emptyList();
- }
- View containerView = (View) view.eContainer();
- if (!containerView.isSetElement()) {
- return Collections.emptyList();
- }
- ExecutionEnvironment modelElement = (ExecutionEnvironment) containerView.getElement();
- LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for (Iterator<?> it = modelElement.getNestedNodes()
- .iterator(); it.hasNext();) {
- Node childElement = (Node) it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == ExecutionEnvironmentEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- for (Iterator<?> it = modelElement.getNestedClassifiers()
- .iterator(); it.hasNext();) {
- Classifier childElement = (Classifier) it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == ArtifactEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLNodeDescriptor> getNodeCompositeCompartment_19SemanticChildren(View view) {
- if (false == view.eContainer() instanceof View) {
- return Collections.emptyList();
- }
- View containerView = (View) view.eContainer();
- if (!containerView.isSetElement()) {
- return Collections.emptyList();
- }
- Node modelElement = (Node) containerView.getElement();
- LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for (Iterator<?> it = modelElement.getNestedNodes()
- .iterator(); it.hasNext();) {
- Node childElement = (Node) it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == DeviceEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == ExecutionEnvironmentEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == NodeEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- for (Iterator<?> it = modelElement.getNestedClassifiers()
- .iterator(); it.hasNext();) {
- Classifier childElement = (Classifier) it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == ArtifactEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLNodeDescriptor> getArtifactArtifactCompositeCompartment_26SemanticChildren(View view) {
- if (false == view.eContainer() instanceof View) {
- return Collections.emptyList();
- }
- View containerView = (View) view.eContainer();
- if (!containerView.isSetElement()) {
- return Collections.emptyList();
- }
- Artifact modelElement = (Artifact) containerView.getElement();
- LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for (Iterator<?> it = modelElement.getNestedArtifacts()
- .iterator(); it.hasNext();) {
- Artifact childElement = (Artifact) it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == ArtifactEditPartACN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLNodeDescriptor> getModelModelCompartment_52SemanticChildren(View view) {
- if (false == view.eContainer() instanceof View) {
- return Collections.emptyList();
- }
- View containerView = (View) view.eContainer();
- if (!containerView.isSetElement()) {
- return Collections.emptyList();
- }
- Model modelElement = (Model) containerView.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 == ModelEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == PackageEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == NestedDeviceEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == NestedExecutionEnvironmentEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == NestedNodeEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == NestedArtifactNodeEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- for (Iterator<?> it = modelElement.getOwnedComments()
- .iterator(); it.hasNext();) {
- Comment childElement = (Comment) it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == CommentEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- for (Iterator<?> it = modelElement.getOwnedRules()
- .iterator(); it.hasNext();) {
- Constraint childElement = (Constraint) it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == ConstraintEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLNodeDescriptor> getPackagePackageableElementCompartment_39SemanticChildren(View view) {
- if (false == view.eContainer() instanceof View) {
- return Collections.emptyList();
- }
- View containerView = (View) view.eContainer();
- if (!containerView.isSetElement()) {
- return Collections.emptyList();
- }
- Package modelElement = (Package) containerView.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 == PackageEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == NestedArtifactNodeEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == NestedDeviceEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == NestedExecutionEnvironmentEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == NestedNodeEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- for (Iterator<?> it = modelElement.getOwnedComments()
- .iterator(); it.hasNext();) {
- Comment childElement = (Comment) it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == CommentEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- for (Iterator<?> it = modelElement.getOwnedRules()
- .iterator(); it.hasNext();) {
- Constraint childElement = (Constraint) it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == ConstraintEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLNodeDescriptor> getDeviceDeviceCompositeCompartment_30SemanticChildren(View view) {
- if (false == view.eContainer() instanceof View) {
- return Collections.emptyList();
- }
- View containerView = (View) view.eContainer();
- if (!containerView.isSetElement()) {
- return Collections.emptyList();
- }
- Device modelElement = (Device) containerView.getElement();
- LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for (Iterator<?> it = modelElement.getNestedNodes()
- .iterator(); it.hasNext();) {
- Node childElement = (Node) it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == ExecutionEnvironmentEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == DeviceEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == NodeEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLNodeDescriptor> getExecutionEnvironmentExecutionEnvironmentCompositeCompartment_31SemanticChildren(View view) {
- if (false == view.eContainer() instanceof View) {
- return Collections.emptyList();
- }
- View containerView = (View) view.eContainer();
- if (!containerView.isSetElement()) {
- return Collections.emptyList();
- }
- ExecutionEnvironment modelElement = (ExecutionEnvironment) containerView.getElement();
- LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for (Iterator<?> it = modelElement.getNestedClassifiers()
- .iterator(); it.hasNext();) {
- Classifier childElement = (Classifier) it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == ArtifactEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- for (Iterator<?> it = modelElement.getNestedNodes()
- .iterator(); it.hasNext();) {
- Node childElement = (Node) it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == ExecutionEnvironmentEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLNodeDescriptor> getNodeCompositeCompartment_32SemanticChildren(View view) {
- if (false == view.eContainer() instanceof View) {
- return Collections.emptyList();
- }
- View containerView = (View) view.eContainer();
- if (!containerView.isSetElement()) {
- return Collections.emptyList();
- }
- Node modelElement = (Node) containerView.getElement();
- LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for (Iterator<?> it = modelElement.getNestedNodes()
- .iterator(); it.hasNext();) {
- Node childElement = (Node) it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == DeviceEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == ExecutionEnvironmentEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- if (visualID == NodeEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- for (Iterator<?> it = modelElement.getNestedClassifiers()
- .iterator(); it.hasNext();) {
- Classifier childElement = (Classifier) it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == ArtifactEditPartCN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLNodeDescriptor> getArtifactArtifactCompositeCompartment_33SemanticChildren(View view) {
- if (false == view.eContainer() instanceof View) {
- return Collections.emptyList();
- }
- View containerView = (View) view.eContainer();
- if (!containerView.isSetElement()) {
- return Collections.emptyList();
- }
- Artifact modelElement = (Artifact) containerView.getElement();
- LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for (Iterator<?> it = modelElement.getNestedArtifacts()
- .iterator(); it.hasNext();) {
- Artifact childElement = (Artifact) it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == ArtifactEditPartACN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLNodeDescriptor> getArtifactArtifactCompositeCompartment_34SemanticChildren(View view) {
- if (false == view.eContainer() instanceof View) {
- return Collections.emptyList();
- }
- View containerView = (View) view.eContainer();
- if (!containerView.isSetElement()) {
- return Collections.emptyList();
- }
- Artifact modelElement = (Artifact) containerView.getElement();
- LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for (Iterator<?> it = modelElement.getNestedArtifacts()
- .iterator(); it.hasNext();) {
- Artifact childElement = (Artifact) it.next();
- int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
- if (visualID == ArtifactEditPartACN.VISUAL_ID) {
- result.add(new UMLNodeDescriptor(childElement, visualID));
- continue;
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- @Override
- public List<UMLLinkDescriptor> getContainedLinks(View view) {
- switch (UMLVisualIDRegistry.getVisualID(view)) {
- case DeploymentDiagramEditPart.VISUAL_ID:
- return getPackage_1000ContainedLinks(view);
- case DependencyNodeEditPart.VISUAL_ID:
- return getDependency_2011ContainedLinks(view);
- case ModelEditPart.VISUAL_ID:
- return getModel_2010ContainedLinks(view);
- case PackageEditPart.VISUAL_ID:
- return getPackage_2009ContainedLinks(view);
- case ConstraintEditPart.VISUAL_ID:
- return getConstraint_2005ContainedLinks(view);
- case CommentEditPart.VISUAL_ID:
- return getComment_2001ContainedLinks(view);
- case ExecutionEnvironmentEditPart.VISUAL_ID:
- return getExecutionEnvironment_2002ContainedLinks(view);
- case DeviceEditPart.VISUAL_ID:
- return getDevice_2003ContainedLinks(view);
- case ArtifactEditPart.VISUAL_ID:
- return getArtifact_2006ContainedLinks(view);
- case NodeEditPart.VISUAL_ID:
- return getNode_2008ContainedLinks(view);
- case DefaultNamedElementEditPart.VISUAL_ID:
- return getNamedElement_2012ContainedLinks(view);
- case ModelEditPartCN.VISUAL_ID:
- return getModel_49ContainedLinks(view);
- case PackageEditPartCN.VISUAL_ID:
- return getPackage_36ContainedLinks(view);
- case DeviceEditPartCN.VISUAL_ID:
- return getDevice_16ContainedLinks(view);
- case NestedDeviceEditPartCN.VISUAL_ID:
- return getDevice_44ContainedLinks(view);
- case ExecutionEnvironmentEditPartCN.VISUAL_ID:
- return getExecutionEnvironment_21ContainedLinks(view);
- case NestedExecutionEnvironmentEditPartCN.VISUAL_ID:
- return getExecutionEnvironment_46ContainedLinks(view);
- case NodeEditPartCN.VISUAL_ID:
- return getNode_23ContainedLinks(view);
- case NestedNodeEditPartCN.VISUAL_ID:
- return getNode_42ContainedLinks(view);
- case ArtifactEditPartCN.VISUAL_ID:
- return getArtifact_25ContainedLinks(view);
- case ArtifactEditPartACN.VISUAL_ID:
- return getArtifact_28ContainedLinks(view);
- case NestedArtifactNodeEditPartCN.VISUAL_ID:
- return getArtifact_40ContainedLinks(view);
- case CommentEditPartCN.VISUAL_ID:
- return getComment_54ContainedLinks(view);
- case ConstraintEditPartCN.VISUAL_ID:
- return getConstraint_56ContainedLinks(view);
- case DeploymentEditPart.VISUAL_ID:
- return getDeployment_4001ContainedLinks(view);
- case ManifestationEditPart.VISUAL_ID:
- return getManifestation_4002ContainedLinks(view);
- case GeneralizationEditPart.VISUAL_ID:
- return getGeneralization_4003ContainedLinks(view);
- case DependencyEditPart.VISUAL_ID:
- return getDependency_4004ContainedLinks(view);
- case DependencyBranchEditPart.VISUAL_ID:
- return getDependency_4010ContainedLinks(view);
- }
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- @Override
- public List<UMLLinkDescriptor> getIncomingLinks(View view) {
- switch (UMLVisualIDRegistry.getVisualID(view)) {
- case DependencyNodeEditPart.VISUAL_ID:
- return getDependency_2011IncomingLinks(view);
- case ModelEditPart.VISUAL_ID:
- return getModel_2010IncomingLinks(view);
- case PackageEditPart.VISUAL_ID:
- return getPackage_2009IncomingLinks(view);
- case ConstraintEditPart.VISUAL_ID:
- return getConstraint_2005IncomingLinks(view);
- case CommentEditPart.VISUAL_ID:
- return getComment_2001IncomingLinks(view);
- case ExecutionEnvironmentEditPart.VISUAL_ID:
- return getExecutionEnvironment_2002IncomingLinks(view);
- case DeviceEditPart.VISUAL_ID:
- return getDevice_2003IncomingLinks(view);
- case ArtifactEditPart.VISUAL_ID:
- return getArtifact_2006IncomingLinks(view);
- case NodeEditPart.VISUAL_ID:
- return getNode_2008IncomingLinks(view);
- case DefaultNamedElementEditPart.VISUAL_ID:
- return getNamedElement_2012IncomingLinks(view);
- case ModelEditPartCN.VISUAL_ID:
- return getModel_49IncomingLinks(view);
- case PackageEditPartCN.VISUAL_ID:
- return getPackage_36IncomingLinks(view);
- case DeviceEditPartCN.VISUAL_ID:
- return getDevice_16IncomingLinks(view);
- case NestedDeviceEditPartCN.VISUAL_ID:
- return getDevice_44IncomingLinks(view);
- case ExecutionEnvironmentEditPartCN.VISUAL_ID:
- return getExecutionEnvironment_21IncomingLinks(view);
- case NestedExecutionEnvironmentEditPartCN.VISUAL_ID:
- return getExecutionEnvironment_46IncomingLinks(view);
- case NodeEditPartCN.VISUAL_ID:
- return getNode_23IncomingLinks(view);
- case NestedNodeEditPartCN.VISUAL_ID:
- return getNode_42IncomingLinks(view);
- case ArtifactEditPartCN.VISUAL_ID:
- return getArtifact_25IncomingLinks(view);
- case ArtifactEditPartACN.VISUAL_ID:
- return getArtifact_28IncomingLinks(view);
- case NestedArtifactNodeEditPartCN.VISUAL_ID:
- return getArtifact_40IncomingLinks(view);
- case CommentEditPartCN.VISUAL_ID:
- return getComment_54IncomingLinks(view);
- case ConstraintEditPartCN.VISUAL_ID:
- return getConstraint_56IncomingLinks(view);
- case DeploymentEditPart.VISUAL_ID:
- return getDeployment_4001IncomingLinks(view);
- case ManifestationEditPart.VISUAL_ID:
- return getManifestation_4002IncomingLinks(view);
- case GeneralizationEditPart.VISUAL_ID:
- return getGeneralization_4003IncomingLinks(view);
- case DependencyEditPart.VISUAL_ID:
- return getDependency_4004IncomingLinks(view);
- case DependencyBranchEditPart.VISUAL_ID:
- return getDependency_4010IncomingLinks(view);
- }
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- @Override
- public List<UMLLinkDescriptor> getOutgoingLinks(View view) {
- switch (UMLVisualIDRegistry.getVisualID(view)) {
- case DependencyNodeEditPart.VISUAL_ID:
- return getDependency_2011OutgoingLinks(view);
- case ModelEditPart.VISUAL_ID:
- return getModel_2010OutgoingLinks(view);
- case PackageEditPart.VISUAL_ID:
- return getPackage_2009OutgoingLinks(view);
- case ConstraintEditPart.VISUAL_ID:
- return getConstraint_2005OutgoingLinks(view);
- case CommentEditPart.VISUAL_ID:
- return getComment_2001OutgoingLinks(view);
- case ExecutionEnvironmentEditPart.VISUAL_ID:
- return getExecutionEnvironment_2002OutgoingLinks(view);
- case DeviceEditPart.VISUAL_ID:
- return getDevice_2003OutgoingLinks(view);
- case ArtifactEditPart.VISUAL_ID:
- return getArtifact_2006OutgoingLinks(view);
- case NodeEditPart.VISUAL_ID:
- return getNode_2008OutgoingLinks(view);
- case DefaultNamedElementEditPart.VISUAL_ID:
- return getNamedElement_2012OutgoingLinks(view);
- case ModelEditPartCN.VISUAL_ID:
- return getModel_49OutgoingLinks(view);
- case PackageEditPartCN.VISUAL_ID:
- return getPackage_36OutgoingLinks(view);
- case DeviceEditPartCN.VISUAL_ID:
- return getDevice_16OutgoingLinks(view);
- case NestedDeviceEditPartCN.VISUAL_ID:
- return getDevice_44OutgoingLinks(view);
- case ExecutionEnvironmentEditPartCN.VISUAL_ID:
- return getExecutionEnvironment_21OutgoingLinks(view);
- case NestedExecutionEnvironmentEditPartCN.VISUAL_ID:
- return getExecutionEnvironment_46OutgoingLinks(view);
- case NodeEditPartCN.VISUAL_ID:
- return getNode_23OutgoingLinks(view);
- case NestedNodeEditPartCN.VISUAL_ID:
- return getNode_42OutgoingLinks(view);
- case ArtifactEditPartCN.VISUAL_ID:
- return getArtifact_25OutgoingLinks(view);
- case ArtifactEditPartACN.VISUAL_ID:
- return getArtifact_28OutgoingLinks(view);
- case NestedArtifactNodeEditPartCN.VISUAL_ID:
- return getArtifact_40OutgoingLinks(view);
- case CommentEditPartCN.VISUAL_ID:
- return getComment_54OutgoingLinks(view);
- case ConstraintEditPartCN.VISUAL_ID:
- return getConstraint_56OutgoingLinks(view);
- case DeploymentEditPart.VISUAL_ID:
- return getDeployment_4001OutgoingLinks(view);
- case ManifestationEditPart.VISUAL_ID:
- return getManifestation_4002OutgoingLinks(view);
- case GeneralizationEditPart.VISUAL_ID:
- return getGeneralization_4003OutgoingLinks(view);
- case DependencyEditPart.VISUAL_ID:
- return getDependency_4004OutgoingLinks(view);
- case DependencyBranchEditPart.VISUAL_ID:
- return getDependency_4010OutgoingLinks(view);
- }
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getPackage_1000ContainedLinks(View view) {
- Package modelElement = (Package) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getDependency_2011ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getModel_2010ContainedLinks(View view) {
- Model modelElement = (Model) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getPackage_2009ContainedLinks(View view) {
- Package modelElement = (Package) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getConstraint_2005ContainedLinks(View view) {
- Constraint modelElement = (Constraint) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getComment_2001ContainedLinks(View view) {
- Comment modelElement = (Comment) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getExecutionEnvironment_2002ContainedLinks(View view) {
- ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Generalization_4003
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getDevice_2003ContainedLinks(View view) {
- Device modelElement = (Device) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Generalization_4003
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getArtifact_2006ContainedLinks(View view) {
- Artifact modelElement = (Artifact) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Generalization_4003
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getNode_2008ContainedLinks(View view) {
- Node modelElement = (Node) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Generalization_4003
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getNamedElement_2012ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getModel_49ContainedLinks(View view) {
- Model modelElement = (Model) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getPackage_36ContainedLinks(View view) {
- Package modelElement = (Package) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getDevice_16ContainedLinks(View view) {
- Device modelElement = (Device) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Generalization_4003
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getDevice_44ContainedLinks(View view) {
- Device modelElement = (Device) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Generalization_4003
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getExecutionEnvironment_21ContainedLinks(View view) {
- ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Generalization_4003
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getExecutionEnvironment_46ContainedLinks(View view) {
- ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Generalization_4003
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getNode_23ContainedLinks(View view) {
- Node modelElement = (Node) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Generalization_4003
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getNode_42ContainedLinks(View view) {
- Node modelElement = (Node) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Generalization_4003
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getArtifact_25ContainedLinks(View view) {
- Artifact modelElement = (Artifact) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Generalization_4003
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getArtifact_28ContainedLinks(View view) {
- Artifact modelElement = (Artifact) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Generalization_4003
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getArtifact_40ContainedLinks(View view) {
- Artifact modelElement = (Artifact) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Generalization_4003
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getComment_54ContainedLinks(View view) {
- Comment modelElement = (Comment) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getConstraint_56ContainedLinks(View view) {
- Constraint modelElement = (Constraint) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getDeployment_4001ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getManifestation_4002ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getGeneralization_4003ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getDependency_4004ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getDependency_4010ContainedLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getDependency_2011IncomingLinks(View view) {
- Dependency modelElement = (Dependency) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getModel_2010IncomingLinks(View view) {
- Model modelElement = (Model) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getPackage_2009IncomingLinks(View view) {
- Package modelElement = (Package) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getConstraint_2005IncomingLinks(View view) {
- Constraint modelElement = (Constraint) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getComment_2001IncomingLinks(View view) {
- Comment modelElement = (Comment) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getExecutionEnvironment_2002IncomingLinks(View view) {
- ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getDevice_2003IncomingLinks(View view) {
- Device modelElement = (Device) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getArtifact_2006IncomingLinks(View view) {
- Artifact modelElement = (Artifact) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getNode_2008IncomingLinks(View view) {
- Node modelElement = (Node) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getNamedElement_2012IncomingLinks(View view) {
- NamedElement modelElement = (NamedElement) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getModel_49IncomingLinks(View view) {
- Model modelElement = (Model) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getPackage_36IncomingLinks(View view) {
- Package modelElement = (Package) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getDevice_16IncomingLinks(View view) {
- Device modelElement = (Device) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getDevice_44IncomingLinks(View view) {
- Device modelElement = (Device) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getExecutionEnvironment_21IncomingLinks(View view) {
- ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getExecutionEnvironment_46IncomingLinks(View view) {
- ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getNode_23IncomingLinks(View view) {
- Node modelElement = (Node) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getNode_42IncomingLinks(View view) {
- Node modelElement = (Node) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getArtifact_25IncomingLinks(View view) {
- Artifact modelElement = (Artifact) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getArtifact_28IncomingLinks(View view) {
- Artifact modelElement = (Artifact) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getArtifact_40IncomingLinks(View view) {
- Artifact modelElement = (Artifact) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getComment_54IncomingLinks(View view) {
- Comment modelElement = (Comment) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getConstraint_56IncomingLinks(View view) {
- Constraint modelElement = (Constraint) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getDeployment_4001IncomingLinks(View view) {
- Deployment modelElement = (Deployment) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getManifestation_4002IncomingLinks(View view) {
- Manifestation modelElement = (Manifestation) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getGeneralization_4003IncomingLinks(View view) {
- Generalization modelElement = (Generalization) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getDependency_4004IncomingLinks(View view) {
- Dependency modelElement = (Dependency) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getDependency_4010IncomingLinks(View view) {
- Dependency modelElement = (Dependency) view.getElement();
- CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004
- (modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
- (modelElement, crossReferencer));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getDependency_2011OutgoingLinks(View view) {
- Dependency modelElement = (Dependency) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getModel_2010OutgoingLinks(View view) {
- Model modelElement = (Model) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getPackage_2009OutgoingLinks(View view) {
- Package modelElement = (Package) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getConstraint_2005OutgoingLinks(View view) {
- Constraint modelElement = (Constraint) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getComment_2001OutgoingLinks(View view) {
- Comment modelElement = (Comment) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getExecutionEnvironment_2002OutgoingLinks(View view) {
- ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getDevice_2003OutgoingLinks(View view) {
- Device modelElement = (Device) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getArtifact_2006OutgoingLinks(View view) {
- Artifact modelElement = (Artifact) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getNode_2008OutgoingLinks(View view) {
- Node modelElement = (Node) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getNamedElement_2012OutgoingLinks(View view) {
- NamedElement modelElement = (NamedElement) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getModel_49OutgoingLinks(View view) {
- Model modelElement = (Model) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getPackage_36OutgoingLinks(View view) {
- Package modelElement = (Package) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getDevice_16OutgoingLinks(View view) {
- Device modelElement = (Device) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getDevice_44OutgoingLinks(View view) {
- Device modelElement = (Device) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getExecutionEnvironment_21OutgoingLinks(View view) {
- ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getExecutionEnvironment_46OutgoingLinks(View view) {
- ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getNode_23OutgoingLinks(View view) {
- Node modelElement = (Node) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getNode_42OutgoingLinks(View view) {
- Node modelElement = (Node) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getArtifact_25OutgoingLinks(View view) {
- Artifact modelElement = (Artifact) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getArtifact_28OutgoingLinks(View view) {
- Artifact modelElement = (Artifact) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getArtifact_40OutgoingLinks(View view) {
- Artifact modelElement = (Artifact) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getComment_54OutgoingLinks(View view) {
- Comment modelElement = (Comment) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4008
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getConstraint_56OutgoingLinks(View view) {
- Constraint modelElement = (Constraint) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getDeployment_4001OutgoingLinks(View view) {
- Deployment modelElement = (Deployment) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getManifestation_4002OutgoingLinks(View view) {
- Manifestation modelElement = (Manifestation) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getGeneralization_4003OutgoingLinks(View view) {
- return Collections.emptyList();
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getDependency_4004OutgoingLinks(View view) {
- Dependency modelElement = (Dependency) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- public List<UMLLinkDescriptor> getDependency_4010OutgoingLinks(View view) {
- Dependency modelElement = (Dependency) view.getElement();
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004
- (modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
- (modelElement));
- return result;
- }
-
- /**
- * @generated
- */
- protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Deployment_4001(DeploymentTarget container) {
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getDeployments()
- .iterator(); links.hasNext();) {
- EObject linkObject = (EObject) links.next();
- if (false == linkObject instanceof Deployment) {
- continue;
- }
- Deployment link = (Deployment) linkObject;
- if (DeploymentEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
- continue;
- }
- List<?> targets = link.getSuppliers();
- Object theTarget = targets.size() == 1 ? targets.get(0) : null;
- if (false == theTarget instanceof NamedElement) {
- continue;
- }
- NamedElement dst = (NamedElement) theTarget;
- List<?> sources = link.getClients();
- Object theSource = sources.size() == 1 ? sources.get(0) : null;
- if (false == theSource instanceof NamedElement) {
- continue;
- }
- NamedElement src = (NamedElement) theSource;
- result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Deployment_4001, DeploymentEditPart.VISUAL_ID));
- }
- return result;
- }
-
- /**
- * @generated
- */
- protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Manifestation_4002(Artifact container) {
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getManifestations()
- .iterator(); links.hasNext();) {
- EObject linkObject = (EObject) links.next();
- if (false == linkObject instanceof Manifestation) {
- continue;
- }
- Manifestation link = (Manifestation) linkObject;
- if (ManifestationEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
- continue;
- }
- List<?> targets = link.getSuppliers();
- Object theTarget = targets.size() == 1 ? targets.get(0) : null;
- if (false == theTarget instanceof NamedElement) {
- continue;
- }
- NamedElement dst = (NamedElement) theTarget;
- List<?> sources = link.getClients();
- Object theSource = sources.size() == 1 ? sources.get(0) : null;
- if (false == theSource instanceof NamedElement) {
- continue;
- }
- NamedElement src = (NamedElement) theSource;
- result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Manifestation_4002, ManifestationEditPart.VISUAL_ID));
- }
- return result;
- }
-
- /**
- * @generated
- */
- protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Generalization_4003(Classifier container) {
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- 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();
- Classifier src = link.getSpecific();
- result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Generalization_4003, GeneralizationEditPart.VISUAL_ID));
- }
- return result;
- }
-
- /**
- * @generated
- */
- protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Dependency_4004(Package container) {
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getPackagedElements()
- .iterator(); links.hasNext();) {
- EObject linkObject = (EObject) links.next();
- if (false == linkObject instanceof Dependency) {
- continue;
- }
- Dependency link = (Dependency) linkObject;
- if (DependencyEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
- continue;
- }
- List<?> targets = link.getSuppliers();
- Object theTarget = targets.size() == 1 ? targets.get(0) : null;
- if (false == theTarget instanceof NamedElement) {
- continue;
- }
- NamedElement dst = (NamedElement) theTarget;
- List<?> sources = link.getClients();
- Object theSource = sources.size() == 1 ? sources.get(0) : null;
- if (false == theSource instanceof NamedElement) {
- continue;
- }
- NamedElement src = (NamedElement) theSource;
- result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Dependency_4004, DependencyEditPart.VISUAL_ID));
- }
- return result;
- }
-
- /**
- * @generated
- */
- protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Dependency_4010(Package container) {
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getPackagedElements()
- .iterator(); links.hasNext();) {
- EObject linkObject = (EObject) links.next();
- if (false == linkObject instanceof Dependency) {
- continue;
- }
- Dependency link = (Dependency) linkObject;
- if (DependencyBranchEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
- continue;
- }
- List<?> targets = link.getSuppliers();
- Object theTarget = targets.size() == 1 ? targets.get(0) : null;
- if (false == theTarget instanceof NamedElement) {
- continue;
- }
- NamedElement dst = (NamedElement) theTarget;
- List<?> sources = link.getClients();
- Object theSource = sources.size() == 1 ? sources.get(0) : null;
- if (false == theSource instanceof NamedElement) {
- continue;
- }
- NamedElement src = (NamedElement) theSource;
- result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Dependency_4010, DependencyBranchEditPart.VISUAL_ID));
- }
- return result;
- }
-
- /**
- * @generated
- */
- protected Collection<UMLLinkDescriptor> getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(Element target, CrossReferenceAdapter crossReferencer) {
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target);
- for (EStructuralFeature.Setting setting : settings) {
- if (setting.getEStructuralFeature() == UMLPackage.eINSTANCE.getComment_AnnotatedElement()) {
- result.add(new UMLLinkDescriptor(setting.getEObject(), target, UMLElementTypes.CommentAnnotatedElement_4008, CommentAnnotatedElementEditPart.VISUAL_ID));
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- protected Collection<UMLLinkDescriptor> getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(Element target, CrossReferenceAdapter crossReferencer) {
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target);
- for (EStructuralFeature.Setting setting : settings) {
- if (setting.getEStructuralFeature() == UMLPackage.eINSTANCE.getConstraint_ConstrainedElement()) {
- result.add(new UMLLinkDescriptor(setting.getEObject(), target, UMLElementTypes.ConstraintConstrainedElement_4009, ConstraintConstrainedElementEditPart.VISUAL_ID));
- }
- }
- return result;
- }
-
- /**
- * @generated
- */
- protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Deployment_4001(NamedElement target, CrossReferenceAdapter crossReferencer) {
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target);
- for (EStructuralFeature.Setting setting : settings) {
- if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getDependency_Supplier() || false == setting.getEObject() instanceof Deployment) {
- continue;
- }
- Deployment link = (Deployment) setting.getEObject();
- if (DeploymentEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
- continue;
- }
- List<?> sources = link.getClients();
- Object theSource = sources.size() == 1 ? sources.get(0) : null;
- if (false == theSource instanceof NamedElement) {
- continue;
- }
- NamedElement src = (NamedElement) theSource;
- result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Deployment_4001, DeploymentEditPart.VISUAL_ID));
- }
- return result;
- }
-
- /**
- * @generated
- */
- protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Manifestation_4002(NamedElement target, CrossReferenceAdapter crossReferencer) {
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target);
- for (EStructuralFeature.Setting setting : settings) {
- if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getDependency_Supplier() || false == setting.getEObject() instanceof Manifestation) {
- continue;
- }
- Manifestation link = (Manifestation) setting.getEObject();
- if (ManifestationEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
- continue;
- }
- List<?> sources = link.getClients();
- Object theSource = sources.size() == 1 ? sources.get(0) : null;
- if (false == theSource instanceof NamedElement) {
- continue;
- }
- NamedElement src = (NamedElement) theSource;
- result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Manifestation_4002, ManifestationEditPart.VISUAL_ID));
- }
- return result;
- }
-
- /**
- * @generated
- */
- protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Generalization_4003(Classifier target, CrossReferenceAdapter crossReferencer) {
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(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;
- }
- Classifier src = link.getSpecific();
- result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Generalization_4003, GeneralizationEditPart.VISUAL_ID));
- }
- return result;
- }
-
- /**
- * @generated
- */
- protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Dependency_4004(NamedElement target, CrossReferenceAdapter crossReferencer) {
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target);
- for (EStructuralFeature.Setting setting : settings) {
- if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getDependency_Supplier() || false == setting.getEObject() instanceof Dependency) {
- continue;
- }
- Dependency link = (Dependency) setting.getEObject();
- if (DependencyEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
- continue;
- }
- List<?> sources = link.getClients();
- Object theSource = sources.size() == 1 ? sources.get(0) : null;
- if (false == theSource instanceof NamedElement) {
- continue;
- }
- NamedElement src = (NamedElement) theSource;
- result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Dependency_4004, DependencyEditPart.VISUAL_ID));
- }
- return result;
- }
-
- /**
- * @generated
- */
- protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Dependency_4010(NamedElement target, CrossReferenceAdapter crossReferencer) {
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target);
- for (EStructuralFeature.Setting setting : settings) {
- if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getDependency_Supplier() || false == setting.getEObject() instanceof Dependency) {
- continue;
- }
- Dependency link = (Dependency) setting.getEObject();
- if (DependencyBranchEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
- continue;
- }
- List<?> sources = link.getClients();
- Object theSource = sources.size() == 1 ? sources.get(0) : null;
- if (false == theSource instanceof NamedElement) {
- continue;
- }
- NamedElement src = (NamedElement) theSource;
- result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Dependency_4010, DependencyBranchEditPart.VISUAL_ID));
- }
- return result;
- }
-
- /**
- * @generated
- */
- protected Collection<UMLLinkDescriptor> getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(Comment source) {
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> destinations = source.getAnnotatedElements()
- .iterator(); destinations.hasNext();) {
- Element destination = (Element) destinations.next();
- result.add(new UMLLinkDescriptor(source, destination, UMLElementTypes.CommentAnnotatedElement_4008, CommentAnnotatedElementEditPart.VISUAL_ID));
- }
- return result;
- }
-
- /**
- * @generated
- */
- protected Collection<UMLLinkDescriptor> getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(Constraint source) {
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> destinations = source.getConstrainedElements()
- .iterator(); destinations.hasNext();) {
- Element destination = (Element) destinations.next();
- result.add(new UMLLinkDescriptor(source, destination, UMLElementTypes.ConstraintConstrainedElement_4009, ConstraintConstrainedElementEditPart.VISUAL_ID));
- }
- return result;
- }
-
- /**
- * @generated
- */
- protected Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Deployment_4001(NamedElement source) {
- DeploymentTarget 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 DeploymentTarget) {
- container = (DeploymentTarget) element;
- }
- }
- if (container == null) {
- return Collections.emptyList();
- }
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getDeployments()
- .iterator(); links.hasNext();) {
- EObject linkObject = (EObject) links.next();
- if (false == linkObject instanceof Deployment) {
- continue;
- }
- Deployment link = (Deployment) linkObject;
- if (DeploymentEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
- continue;
- }
- List<?> targets = link.getSuppliers();
- Object theTarget = targets.size() == 1 ? targets.get(0) : null;
- if (false == theTarget instanceof NamedElement) {
- continue;
- }
- NamedElement dst = (NamedElement) theTarget;
- List<?> sources = link.getClients();
- Object theSource = sources.size() == 1 ? sources.get(0) : null;
- if (false == theSource instanceof NamedElement) {
- continue;
- }
- NamedElement src = (NamedElement) theSource;
- if (src != source) {
- continue;
- }
- result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Deployment_4001, DeploymentEditPart.VISUAL_ID));
- }
- return result;
- }
-
- /**
- * @generated
- */
- protected Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Manifestation_4002(NamedElement source) {
- Artifact 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 Artifact) {
- container = (Artifact) element;
- }
- }
- if (container == null) {
- return Collections.emptyList();
- }
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getManifestations()
- .iterator(); links.hasNext();) {
- EObject linkObject = (EObject) links.next();
- if (false == linkObject instanceof Manifestation) {
- continue;
- }
- Manifestation link = (Manifestation) linkObject;
- if (ManifestationEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
- continue;
- }
- List<?> targets = link.getSuppliers();
- Object theTarget = targets.size() == 1 ? targets.get(0) : null;
- if (false == theTarget instanceof NamedElement) {
- continue;
- }
- NamedElement dst = (NamedElement) theTarget;
- List<?> sources = link.getClients();
- Object theSource = sources.size() == 1 ? sources.get(0) : null;
- if (false == theSource instanceof NamedElement) {
- continue;
- }
- NamedElement src = (NamedElement) theSource;
- if (src != source) {
- continue;
- }
- result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Manifestation_4002, ManifestationEditPart.VISUAL_ID));
- }
- return result;
- }
-
- /**
- * @generated
- */
- protected Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Generalization_4003(Classifier source) {
- Classifier 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 Classifier) {
- container = (Classifier) element;
- }
- }
- if (container == null) {
- return Collections.emptyList();
- }
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- 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();
- Classifier src = link.getSpecific();
- if (src != source) {
- continue;
- }
- result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Generalization_4003, GeneralizationEditPart.VISUAL_ID));
- }
- return result;
- }
-
- /**
- * @generated
- */
- protected Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Dependency_4004(NamedElement source) {
- Package 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 Package) {
- container = (Package) element;
- }
- }
- if (container == null) {
- return Collections.emptyList();
- }
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getPackagedElements()
- .iterator(); links.hasNext();) {
- EObject linkObject = (EObject) links.next();
- if (false == linkObject instanceof Dependency) {
- continue;
- }
- Dependency link = (Dependency) linkObject;
- if (DependencyEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
- continue;
- }
- List<?> targets = link.getSuppliers();
- Object theTarget = targets.size() == 1 ? targets.get(0) : null;
- if (false == theTarget instanceof NamedElement) {
- continue;
- }
- NamedElement dst = (NamedElement) theTarget;
- List<?> sources = link.getClients();
- Object theSource = sources.size() == 1 ? sources.get(0) : null;
- if (false == theSource instanceof NamedElement) {
- continue;
- }
- NamedElement src = (NamedElement) theSource;
- if (src != source) {
- continue;
- }
- result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Dependency_4004, DependencyEditPart.VISUAL_ID));
- }
- return result;
- }
-
- /**
- * @generated
- */
- protected Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Dependency_4010(NamedElement source) {
- Package 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 Package) {
- container = (Package) element;
- }
- }
- if (container == null) {
- return Collections.emptyList();
- }
- LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getPackagedElements()
- .iterator(); links.hasNext();) {
- EObject linkObject = (EObject) links.next();
- if (false == linkObject instanceof Dependency) {
- continue;
- }
- Dependency link = (Dependency) linkObject;
- if (DependencyBranchEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
- continue;
- }
- List<?> targets = link.getSuppliers();
- Object theTarget = targets.size() == 1 ? targets.get(0) : null;
- if (false == theTarget instanceof NamedElement) {
- continue;
- }
- NamedElement dst = (NamedElement) theTarget;
- List<?> sources = link.getClients();
- Object theSource = sources.size() == 1 ? sources.get(0) : null;
- if (false == theSource instanceof NamedElement) {
- continue;
- }
- NamedElement src = (NamedElement) theSource;
- if (src != source) {
- continue;
- }
- result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Dependency_4010, DependencyBranchEditPart.VISUAL_ID));
- }
- return result;
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.part;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gmf.runtime.emf.core.util.CrossReferenceAdapter;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.update.DiagramUpdater;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactCompositeCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactCompositeCompartmentEditPartACN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactCompositeCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPartACN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DefaultNamedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNodeEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceCompositeCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceCompositeCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentCompositeCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentCompositeCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelPackageableElementCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelPackageableElementCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedArtifactNodeEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedDeviceEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedExecutionEnvironmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedNodeEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeCompositeCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeCompositeCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackagePackageableElementCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackagePackageableElementCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.Artifact;
+import org.eclipse.uml2.uml.Classifier;
+import org.eclipse.uml2.uml.Comment;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.Dependency;
+import org.eclipse.uml2.uml.Deployment;
+import org.eclipse.uml2.uml.DeploymentTarget;
+import org.eclipse.uml2.uml.Device;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.ExecutionEnvironment;
+import org.eclipse.uml2.uml.Generalization;
+import org.eclipse.uml2.uml.Manifestation;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Node;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.PackageableElement;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class UMLDiagramUpdater implements DiagramUpdater {
+
+ /**
+ * @generated
+ */
+ public static final org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramUpdater INSTANCE = new UMLDiagramUpdater();
+
+ /**
+ * @generated
+ */
+ protected UMLDiagramUpdater() {
+ //to prevent instantiation allowing the override
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public List<UMLNodeDescriptor> getSemanticChildren(View view) {
+ switch (UMLVisualIDRegistry.getVisualID(view)) {
+ case DeploymentDiagramEditPart.VISUAL_ID:
+ return getPackage_1000SemanticChildren(view);
+ case ModelPackageableElementCompartmentEditPart.VISUAL_ID:
+ return getModelModelCompartment_51SemanticChildren(view);
+ case PackagePackageableElementCompartmentEditPart.VISUAL_ID:
+ return getPackagePackageableElementCompartment_38SemanticChildren(view);
+ case DeviceCompositeCompartmentEditPart.VISUAL_ID:
+ return getDeviceDeviceCompositeCompartment_17SemanticChildren(view);
+ case ExecutionEnvironmentCompositeCompartmentEditPart.VISUAL_ID:
+ return getExecutionEnvironmentExecutionEnvironmentCompositeCompartment_18SemanticChildren(view);
+ case NodeCompositeCompartmentEditPart.VISUAL_ID:
+ return getNodeCompositeCompartment_19SemanticChildren(view);
+ case ArtifactCompositeCompartmentEditPart.VISUAL_ID:
+ return getArtifactArtifactCompositeCompartment_26SemanticChildren(view);
+ case ModelPackageableElementCompartmentEditPartCN.VISUAL_ID:
+ return getModelModelCompartment_52SemanticChildren(view);
+ case PackagePackageableElementCompartmentEditPartCN.VISUAL_ID:
+ return getPackagePackageableElementCompartment_39SemanticChildren(view);
+ case DeviceCompositeCompartmentEditPartCN.VISUAL_ID:
+ return getDeviceDeviceCompositeCompartment_30SemanticChildren(view);
+ case ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID:
+ return getExecutionEnvironmentExecutionEnvironmentCompositeCompartment_31SemanticChildren(view);
+ case NodeCompositeCompartmentEditPartCN.VISUAL_ID:
+ return getNodeCompositeCompartment_32SemanticChildren(view);
+ case ArtifactCompositeCompartmentEditPartCN.VISUAL_ID:
+ return getArtifactArtifactCompositeCompartment_33SemanticChildren(view);
+ case ArtifactCompositeCompartmentEditPartACN.VISUAL_ID:
+ return getArtifactArtifactCompositeCompartment_34SemanticChildren(view);
+ }
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLNodeDescriptor> getPackage_1000SemanticChildren(View view) {
+ if (!view.isSetElement()) {
+ return Collections.emptyList();
+ }
+ 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 == DependencyNodeEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == ModelEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == PackageEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == ExecutionEnvironmentEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == DeviceEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == ArtifactEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == NodeEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == DefaultNamedElementEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ for (Iterator<?> it = modelElement.getOwnedRules()
+ .iterator(); it.hasNext();) {
+ Constraint childElement = (Constraint) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == ConstraintEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ for (Iterator<?> it = modelElement.getOwnedComments()
+ .iterator(); it.hasNext();) {
+ Comment childElement = (Comment) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == CommentEditPart.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLNodeDescriptor> getModelModelCompartment_51SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.emptyList();
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.emptyList();
+ }
+ Model modelElement = (Model) containerView.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 == ModelEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == PackageEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == NestedDeviceEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == NestedExecutionEnvironmentEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == NestedNodeEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == NestedArtifactNodeEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ for (Iterator<?> it = modelElement.getOwnedComments()
+ .iterator(); it.hasNext();) {
+ Comment childElement = (Comment) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == CommentEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ for (Iterator<?> it = modelElement.getOwnedRules()
+ .iterator(); it.hasNext();) {
+ Constraint childElement = (Constraint) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == ConstraintEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLNodeDescriptor> getPackagePackageableElementCompartment_38SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.emptyList();
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.emptyList();
+ }
+ Package modelElement = (Package) containerView.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 == ModelEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == PackageEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == NestedArtifactNodeEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == NestedDeviceEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == NestedExecutionEnvironmentEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == NestedNodeEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ for (Iterator<?> it = modelElement.getOwnedComments()
+ .iterator(); it.hasNext();) {
+ Comment childElement = (Comment) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == CommentEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ for (Iterator<?> it = modelElement.getOwnedRules()
+ .iterator(); it.hasNext();) {
+ Constraint childElement = (Constraint) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == ConstraintEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLNodeDescriptor> getDeviceDeviceCompositeCompartment_17SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.emptyList();
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.emptyList();
+ }
+ Device modelElement = (Device) containerView.getElement();
+ LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
+ for (Iterator<?> it = modelElement.getNestedNodes()
+ .iterator(); it.hasNext();) {
+ Node childElement = (Node) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == ExecutionEnvironmentEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == DeviceEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == NodeEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLNodeDescriptor> getExecutionEnvironmentExecutionEnvironmentCompositeCompartment_18SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.emptyList();
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.emptyList();
+ }
+ ExecutionEnvironment modelElement = (ExecutionEnvironment) containerView.getElement();
+ LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
+ for (Iterator<?> it = modelElement.getNestedNodes()
+ .iterator(); it.hasNext();) {
+ Node childElement = (Node) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == ExecutionEnvironmentEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ for (Iterator<?> it = modelElement.getNestedClassifiers()
+ .iterator(); it.hasNext();) {
+ Classifier childElement = (Classifier) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == ArtifactEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLNodeDescriptor> getNodeCompositeCompartment_19SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.emptyList();
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.emptyList();
+ }
+ Node modelElement = (Node) containerView.getElement();
+ LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
+ for (Iterator<?> it = modelElement.getNestedNodes()
+ .iterator(); it.hasNext();) {
+ Node childElement = (Node) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == DeviceEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == ExecutionEnvironmentEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == NodeEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ for (Iterator<?> it = modelElement.getNestedClassifiers()
+ .iterator(); it.hasNext();) {
+ Classifier childElement = (Classifier) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == ArtifactEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLNodeDescriptor> getArtifactArtifactCompositeCompartment_26SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.emptyList();
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.emptyList();
+ }
+ Artifact modelElement = (Artifact) containerView.getElement();
+ LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
+ for (Iterator<?> it = modelElement.getNestedArtifacts()
+ .iterator(); it.hasNext();) {
+ Artifact childElement = (Artifact) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == ArtifactEditPartACN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLNodeDescriptor> getModelModelCompartment_52SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.emptyList();
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.emptyList();
+ }
+ Model modelElement = (Model) containerView.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 == ModelEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == PackageEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == NestedDeviceEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == NestedExecutionEnvironmentEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == NestedNodeEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == NestedArtifactNodeEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ for (Iterator<?> it = modelElement.getOwnedComments()
+ .iterator(); it.hasNext();) {
+ Comment childElement = (Comment) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == CommentEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ for (Iterator<?> it = modelElement.getOwnedRules()
+ .iterator(); it.hasNext();) {
+ Constraint childElement = (Constraint) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == ConstraintEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLNodeDescriptor> getPackagePackageableElementCompartment_39SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.emptyList();
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.emptyList();
+ }
+ Package modelElement = (Package) containerView.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 == PackageEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == NestedArtifactNodeEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == NestedDeviceEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == NestedExecutionEnvironmentEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == NestedNodeEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ for (Iterator<?> it = modelElement.getOwnedComments()
+ .iterator(); it.hasNext();) {
+ Comment childElement = (Comment) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == CommentEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ for (Iterator<?> it = modelElement.getOwnedRules()
+ .iterator(); it.hasNext();) {
+ Constraint childElement = (Constraint) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == ConstraintEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLNodeDescriptor> getDeviceDeviceCompositeCompartment_30SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.emptyList();
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.emptyList();
+ }
+ Device modelElement = (Device) containerView.getElement();
+ LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
+ for (Iterator<?> it = modelElement.getNestedNodes()
+ .iterator(); it.hasNext();) {
+ Node childElement = (Node) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == ExecutionEnvironmentEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == DeviceEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == NodeEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLNodeDescriptor> getExecutionEnvironmentExecutionEnvironmentCompositeCompartment_31SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.emptyList();
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.emptyList();
+ }
+ ExecutionEnvironment modelElement = (ExecutionEnvironment) containerView.getElement();
+ LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
+ for (Iterator<?> it = modelElement.getNestedClassifiers()
+ .iterator(); it.hasNext();) {
+ Classifier childElement = (Classifier) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == ArtifactEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ for (Iterator<?> it = modelElement.getNestedNodes()
+ .iterator(); it.hasNext();) {
+ Node childElement = (Node) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == ExecutionEnvironmentEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLNodeDescriptor> getNodeCompositeCompartment_32SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.emptyList();
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.emptyList();
+ }
+ Node modelElement = (Node) containerView.getElement();
+ LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
+ for (Iterator<?> it = modelElement.getNestedNodes()
+ .iterator(); it.hasNext();) {
+ Node childElement = (Node) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == DeviceEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == ExecutionEnvironmentEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == NodeEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ for (Iterator<?> it = modelElement.getNestedClassifiers()
+ .iterator(); it.hasNext();) {
+ Classifier childElement = (Classifier) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == ArtifactEditPartCN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLNodeDescriptor> getArtifactArtifactCompositeCompartment_33SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.emptyList();
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.emptyList();
+ }
+ Artifact modelElement = (Artifact) containerView.getElement();
+ LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
+ for (Iterator<?> it = modelElement.getNestedArtifacts()
+ .iterator(); it.hasNext();) {
+ Artifact childElement = (Artifact) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == ArtifactEditPartACN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLNodeDescriptor> getArtifactArtifactCompositeCompartment_34SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.emptyList();
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.emptyList();
+ }
+ Artifact modelElement = (Artifact) containerView.getElement();
+ LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
+ for (Iterator<?> it = modelElement.getNestedArtifacts()
+ .iterator(); it.hasNext();) {
+ Artifact childElement = (Artifact) it.next();
+ int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == ArtifactEditPartACN.VISUAL_ID) {
+ result.add(new UMLNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public List<UMLLinkDescriptor> getContainedLinks(View view) {
+ switch (UMLVisualIDRegistry.getVisualID(view)) {
+ case DeploymentDiagramEditPart.VISUAL_ID:
+ return getPackage_1000ContainedLinks(view);
+ case DependencyNodeEditPart.VISUAL_ID:
+ return getDependency_2011ContainedLinks(view);
+ case ModelEditPart.VISUAL_ID:
+ return getModel_2010ContainedLinks(view);
+ case PackageEditPart.VISUAL_ID:
+ return getPackage_2009ContainedLinks(view);
+ case ConstraintEditPart.VISUAL_ID:
+ return getConstraint_2005ContainedLinks(view);
+ case CommentEditPart.VISUAL_ID:
+ return getComment_2001ContainedLinks(view);
+ case ExecutionEnvironmentEditPart.VISUAL_ID:
+ return getExecutionEnvironment_2002ContainedLinks(view);
+ case DeviceEditPart.VISUAL_ID:
+ return getDevice_2003ContainedLinks(view);
+ case ArtifactEditPart.VISUAL_ID:
+ return getArtifact_2006ContainedLinks(view);
+ case NodeEditPart.VISUAL_ID:
+ return getNode_2008ContainedLinks(view);
+ case DefaultNamedElementEditPart.VISUAL_ID:
+ return getNamedElement_2012ContainedLinks(view);
+ case ModelEditPartCN.VISUAL_ID:
+ return getModel_49ContainedLinks(view);
+ case PackageEditPartCN.VISUAL_ID:
+ return getPackage_36ContainedLinks(view);
+ case DeviceEditPartCN.VISUAL_ID:
+ return getDevice_16ContainedLinks(view);
+ case NestedDeviceEditPartCN.VISUAL_ID:
+ return getDevice_44ContainedLinks(view);
+ case ExecutionEnvironmentEditPartCN.VISUAL_ID:
+ return getExecutionEnvironment_21ContainedLinks(view);
+ case NestedExecutionEnvironmentEditPartCN.VISUAL_ID:
+ return getExecutionEnvironment_46ContainedLinks(view);
+ case NodeEditPartCN.VISUAL_ID:
+ return getNode_23ContainedLinks(view);
+ case NestedNodeEditPartCN.VISUAL_ID:
+ return getNode_42ContainedLinks(view);
+ case ArtifactEditPartCN.VISUAL_ID:
+ return getArtifact_25ContainedLinks(view);
+ case ArtifactEditPartACN.VISUAL_ID:
+ return getArtifact_28ContainedLinks(view);
+ case NestedArtifactNodeEditPartCN.VISUAL_ID:
+ return getArtifact_40ContainedLinks(view);
+ case CommentEditPartCN.VISUAL_ID:
+ return getComment_54ContainedLinks(view);
+ case ConstraintEditPartCN.VISUAL_ID:
+ return getConstraint_56ContainedLinks(view);
+ case DeploymentEditPart.VISUAL_ID:
+ return getDeployment_4001ContainedLinks(view);
+ case ManifestationEditPart.VISUAL_ID:
+ return getManifestation_4002ContainedLinks(view);
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGeneralization_4003ContainedLinks(view);
+ case DependencyEditPart.VISUAL_ID:
+ return getDependency_4004ContainedLinks(view);
+ case DependencyBranchEditPart.VISUAL_ID:
+ return getDependency_4010ContainedLinks(view);
+ }
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public List<UMLLinkDescriptor> getIncomingLinks(View view) {
+ switch (UMLVisualIDRegistry.getVisualID(view)) {
+ case DependencyNodeEditPart.VISUAL_ID:
+ return getDependency_2011IncomingLinks(view);
+ case ModelEditPart.VISUAL_ID:
+ return getModel_2010IncomingLinks(view);
+ case PackageEditPart.VISUAL_ID:
+ return getPackage_2009IncomingLinks(view);
+ case ConstraintEditPart.VISUAL_ID:
+ return getConstraint_2005IncomingLinks(view);
+ case CommentEditPart.VISUAL_ID:
+ return getComment_2001IncomingLinks(view);
+ case ExecutionEnvironmentEditPart.VISUAL_ID:
+ return getExecutionEnvironment_2002IncomingLinks(view);
+ case DeviceEditPart.VISUAL_ID:
+ return getDevice_2003IncomingLinks(view);
+ case ArtifactEditPart.VISUAL_ID:
+ return getArtifact_2006IncomingLinks(view);
+ case NodeEditPart.VISUAL_ID:
+ return getNode_2008IncomingLinks(view);
+ case DefaultNamedElementEditPart.VISUAL_ID:
+ return getNamedElement_2012IncomingLinks(view);
+ case ModelEditPartCN.VISUAL_ID:
+ return getModel_49IncomingLinks(view);
+ case PackageEditPartCN.VISUAL_ID:
+ return getPackage_36IncomingLinks(view);
+ case DeviceEditPartCN.VISUAL_ID:
+ return getDevice_16IncomingLinks(view);
+ case NestedDeviceEditPartCN.VISUAL_ID:
+ return getDevice_44IncomingLinks(view);
+ case ExecutionEnvironmentEditPartCN.VISUAL_ID:
+ return getExecutionEnvironment_21IncomingLinks(view);
+ case NestedExecutionEnvironmentEditPartCN.VISUAL_ID:
+ return getExecutionEnvironment_46IncomingLinks(view);
+ case NodeEditPartCN.VISUAL_ID:
+ return getNode_23IncomingLinks(view);
+ case NestedNodeEditPartCN.VISUAL_ID:
+ return getNode_42IncomingLinks(view);
+ case ArtifactEditPartCN.VISUAL_ID:
+ return getArtifact_25IncomingLinks(view);
+ case ArtifactEditPartACN.VISUAL_ID:
+ return getArtifact_28IncomingLinks(view);
+ case NestedArtifactNodeEditPartCN.VISUAL_ID:
+ return getArtifact_40IncomingLinks(view);
+ case CommentEditPartCN.VISUAL_ID:
+ return getComment_54IncomingLinks(view);
+ case ConstraintEditPartCN.VISUAL_ID:
+ return getConstraint_56IncomingLinks(view);
+ case DeploymentEditPart.VISUAL_ID:
+ return getDeployment_4001IncomingLinks(view);
+ case ManifestationEditPart.VISUAL_ID:
+ return getManifestation_4002IncomingLinks(view);
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGeneralization_4003IncomingLinks(view);
+ case DependencyEditPart.VISUAL_ID:
+ return getDependency_4004IncomingLinks(view);
+ case DependencyBranchEditPart.VISUAL_ID:
+ return getDependency_4010IncomingLinks(view);
+ }
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public List<UMLLinkDescriptor> getOutgoingLinks(View view) {
+ switch (UMLVisualIDRegistry.getVisualID(view)) {
+ case DependencyNodeEditPart.VISUAL_ID:
+ return getDependency_2011OutgoingLinks(view);
+ case ModelEditPart.VISUAL_ID:
+ return getModel_2010OutgoingLinks(view);
+ case PackageEditPart.VISUAL_ID:
+ return getPackage_2009OutgoingLinks(view);
+ case ConstraintEditPart.VISUAL_ID:
+ return getConstraint_2005OutgoingLinks(view);
+ case CommentEditPart.VISUAL_ID:
+ return getComment_2001OutgoingLinks(view);
+ case ExecutionEnvironmentEditPart.VISUAL_ID:
+ return getExecutionEnvironment_2002OutgoingLinks(view);
+ case DeviceEditPart.VISUAL_ID:
+ return getDevice_2003OutgoingLinks(view);
+ case ArtifactEditPart.VISUAL_ID:
+ return getArtifact_2006OutgoingLinks(view);
+ case NodeEditPart.VISUAL_ID:
+ return getNode_2008OutgoingLinks(view);
+ case DefaultNamedElementEditPart.VISUAL_ID:
+ return getNamedElement_2012OutgoingLinks(view);
+ case ModelEditPartCN.VISUAL_ID:
+ return getModel_49OutgoingLinks(view);
+ case PackageEditPartCN.VISUAL_ID:
+ return getPackage_36OutgoingLinks(view);
+ case DeviceEditPartCN.VISUAL_ID:
+ return getDevice_16OutgoingLinks(view);
+ case NestedDeviceEditPartCN.VISUAL_ID:
+ return getDevice_44OutgoingLinks(view);
+ case ExecutionEnvironmentEditPartCN.VISUAL_ID:
+ return getExecutionEnvironment_21OutgoingLinks(view);
+ case NestedExecutionEnvironmentEditPartCN.VISUAL_ID:
+ return getExecutionEnvironment_46OutgoingLinks(view);
+ case NodeEditPartCN.VISUAL_ID:
+ return getNode_23OutgoingLinks(view);
+ case NestedNodeEditPartCN.VISUAL_ID:
+ return getNode_42OutgoingLinks(view);
+ case ArtifactEditPartCN.VISUAL_ID:
+ return getArtifact_25OutgoingLinks(view);
+ case ArtifactEditPartACN.VISUAL_ID:
+ return getArtifact_28OutgoingLinks(view);
+ case NestedArtifactNodeEditPartCN.VISUAL_ID:
+ return getArtifact_40OutgoingLinks(view);
+ case CommentEditPartCN.VISUAL_ID:
+ return getComment_54OutgoingLinks(view);
+ case ConstraintEditPartCN.VISUAL_ID:
+ return getConstraint_56OutgoingLinks(view);
+ case DeploymentEditPart.VISUAL_ID:
+ return getDeployment_4001OutgoingLinks(view);
+ case ManifestationEditPart.VISUAL_ID:
+ return getManifestation_4002OutgoingLinks(view);
+ case GeneralizationEditPart.VISUAL_ID:
+ return getGeneralization_4003OutgoingLinks(view);
+ case DependencyEditPart.VISUAL_ID:
+ return getDependency_4004OutgoingLinks(view);
+ case DependencyBranchEditPart.VISUAL_ID:
+ return getDependency_4010OutgoingLinks(view);
+ }
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getPackage_1000ContainedLinks(View view) {
+ Package modelElement = (Package) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getDependency_2011ContainedLinks(View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getModel_2010ContainedLinks(View view) {
+ Model modelElement = (Model) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getPackage_2009ContainedLinks(View view) {
+ Package modelElement = (Package) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getConstraint_2005ContainedLinks(View view) {
+ Constraint modelElement = (Constraint) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getComment_2001ContainedLinks(View view) {
+ Comment modelElement = (Comment) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getExecutionEnvironment_2002ContainedLinks(View view) {
+ ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getContainedTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getDevice_2003ContainedLinks(View view) {
+ Device modelElement = (Device) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getContainedTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getArtifact_2006ContainedLinks(View view) {
+ Artifact modelElement = (Artifact) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getContainedTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getNode_2008ContainedLinks(View view) {
+ Node modelElement = (Node) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getContainedTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getNamedElement_2012ContainedLinks(View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getModel_49ContainedLinks(View view) {
+ Model modelElement = (Model) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getPackage_36ContainedLinks(View view) {
+ Package modelElement = (Package) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getDevice_16ContainedLinks(View view) {
+ Device modelElement = (Device) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getContainedTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getDevice_44ContainedLinks(View view) {
+ Device modelElement = (Device) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getContainedTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getExecutionEnvironment_21ContainedLinks(View view) {
+ ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getContainedTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getExecutionEnvironment_46ContainedLinks(View view) {
+ ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getContainedTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getNode_23ContainedLinks(View view) {
+ Node modelElement = (Node) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getContainedTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getNode_42ContainedLinks(View view) {
+ Node modelElement = (Node) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getContainedTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getArtifact_25ContainedLinks(View view) {
+ Artifact modelElement = (Artifact) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getContainedTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getArtifact_28ContainedLinks(View view) {
+ Artifact modelElement = (Artifact) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getContainedTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getArtifact_40ContainedLinks(View view) {
+ Artifact modelElement = (Artifact) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getContainedTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getComment_54ContainedLinks(View view) {
+ Comment modelElement = (Comment) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getConstraint_56ContainedLinks(View view) {
+ Constraint modelElement = (Constraint) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getDeployment_4001ContainedLinks(View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getManifestation_4002ContainedLinks(View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getGeneralization_4003ContainedLinks(View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getDependency_4004ContainedLinks(View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getDependency_4010ContainedLinks(View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getDependency_2011IncomingLinks(View view) {
+ Dependency modelElement = (Dependency) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getModel_2010IncomingLinks(View view) {
+ Model modelElement = (Model) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getPackage_2009IncomingLinks(View view) {
+ Package modelElement = (Package) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getConstraint_2005IncomingLinks(View view) {
+ Constraint modelElement = (Constraint) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getComment_2001IncomingLinks(View view) {
+ Comment modelElement = (Comment) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getExecutionEnvironment_2002IncomingLinks(View view) {
+ ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getDevice_2003IncomingLinks(View view) {
+ Device modelElement = (Device) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getArtifact_2006IncomingLinks(View view) {
+ Artifact modelElement = (Artifact) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getNode_2008IncomingLinks(View view) {
+ Node modelElement = (Node) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getNamedElement_2012IncomingLinks(View view) {
+ NamedElement modelElement = (NamedElement) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getModel_49IncomingLinks(View view) {
+ Model modelElement = (Model) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getPackage_36IncomingLinks(View view) {
+ Package modelElement = (Package) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getDevice_16IncomingLinks(View view) {
+ Device modelElement = (Device) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getDevice_44IncomingLinks(View view) {
+ Device modelElement = (Device) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getExecutionEnvironment_21IncomingLinks(View view) {
+ ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getExecutionEnvironment_46IncomingLinks(View view) {
+ ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getNode_23IncomingLinks(View view) {
+ Node modelElement = (Node) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getNode_42IncomingLinks(View view) {
+ Node modelElement = (Node) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getArtifact_25IncomingLinks(View view) {
+ Artifact modelElement = (Artifact) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getArtifact_28IncomingLinks(View view) {
+ Artifact modelElement = (Artifact) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getArtifact_40IncomingLinks(View view) {
+ Artifact modelElement = (Artifact) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getComment_54IncomingLinks(View view) {
+ Comment modelElement = (Comment) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getConstraint_56IncomingLinks(View view) {
+ Constraint modelElement = (Constraint) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getDeployment_4001IncomingLinks(View view) {
+ Deployment modelElement = (Deployment) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getManifestation_4002IncomingLinks(View view) {
+ Manifestation modelElement = (Manifestation) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getGeneralization_4003IncomingLinks(View view) {
+ Generalization modelElement = (Generalization) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getDependency_4004IncomingLinks(View view) {
+ Dependency modelElement = (Dependency) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getDependency_4010IncomingLinks(View view) {
+ Dependency modelElement = (Dependency) view.getElement();
+ CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getDependency_2011OutgoingLinks(View view) {
+ Dependency modelElement = (Dependency) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getModel_2010OutgoingLinks(View view) {
+ Model modelElement = (Model) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getPackage_2009OutgoingLinks(View view) {
+ Package modelElement = (Package) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getConstraint_2005OutgoingLinks(View view) {
+ Constraint modelElement = (Constraint) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getComment_2001OutgoingLinks(View view) {
+ Comment modelElement = (Comment) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getExecutionEnvironment_2002OutgoingLinks(View view) {
+ ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getDevice_2003OutgoingLinks(View view) {
+ Device modelElement = (Device) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getArtifact_2006OutgoingLinks(View view) {
+ Artifact modelElement = (Artifact) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getNode_2008OutgoingLinks(View view) {
+ Node modelElement = (Node) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getNamedElement_2012OutgoingLinks(View view) {
+ NamedElement modelElement = (NamedElement) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getModel_49OutgoingLinks(View view) {
+ Model modelElement = (Model) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getPackage_36OutgoingLinks(View view) {
+ Package modelElement = (Package) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getDevice_16OutgoingLinks(View view) {
+ Device modelElement = (Device) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getDevice_44OutgoingLinks(View view) {
+ Device modelElement = (Device) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getExecutionEnvironment_21OutgoingLinks(View view) {
+ ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getExecutionEnvironment_46OutgoingLinks(View view) {
+ ExecutionEnvironment modelElement = (ExecutionEnvironment) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getNode_23OutgoingLinks(View view) {
+ Node modelElement = (Node) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getNode_42OutgoingLinks(View view) {
+ Node modelElement = (Node) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getArtifact_25OutgoingLinks(View view) {
+ Artifact modelElement = (Artifact) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getArtifact_28OutgoingLinks(View view) {
+ Artifact modelElement = (Artifact) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getArtifact_40OutgoingLinks(View view) {
+ Artifact modelElement = (Artifact) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getComment_54OutgoingLinks(View view) {
+ Comment modelElement = (Comment) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getConstraint_56OutgoingLinks(View view) {
+ Constraint modelElement = (Constraint) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getDeployment_4001OutgoingLinks(View view) {
+ Deployment modelElement = (Deployment) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getManifestation_4002OutgoingLinks(View view) {
+ Manifestation modelElement = (Manifestation) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getGeneralization_4003OutgoingLinks(View view) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getDependency_4004OutgoingLinks(View view) {
+ Dependency modelElement = (Dependency) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public List<UMLLinkDescriptor> getDependency_4010OutgoingLinks(View view) {
+ Dependency modelElement = (Dependency) view.getElement();
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Deployment_4001(DeploymentTarget container) {
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ for (Iterator<?> links = container.getDeployments()
+ .iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Deployment) {
+ continue;
+ }
+ Deployment link = (Deployment) linkObject;
+ if (DeploymentEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List<?> targets = link.getSuppliers();
+ Object theTarget = targets.size() == 1 ? targets.get(0) : null;
+ if (false == theTarget instanceof NamedElement) {
+ continue;
+ }
+ NamedElement dst = (NamedElement) theTarget;
+ List<?> sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Deployment_4001, DeploymentEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Manifestation_4002(Artifact container) {
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ for (Iterator<?> links = container.getManifestations()
+ .iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Manifestation) {
+ continue;
+ }
+ Manifestation link = (Manifestation) linkObject;
+ if (ManifestationEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List<?> targets = link.getSuppliers();
+ Object theTarget = targets.size() == 1 ? targets.get(0) : null;
+ if (false == theTarget instanceof NamedElement) {
+ continue;
+ }
+ NamedElement dst = (NamedElement) theTarget;
+ List<?> sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Manifestation_4002, ManifestationEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Generalization_4003(Classifier container) {
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ 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();
+ Classifier src = link.getSpecific();
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Generalization_4003, GeneralizationEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Dependency_4004(Package container) {
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ for (Iterator<?> links = container.getPackagedElements()
+ .iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Dependency) {
+ continue;
+ }
+ Dependency link = (Dependency) linkObject;
+ if (DependencyEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List<?> targets = link.getSuppliers();
+ Object theTarget = targets.size() == 1 ? targets.get(0) : null;
+ if (false == theTarget instanceof NamedElement) {
+ continue;
+ }
+ NamedElement dst = (NamedElement) theTarget;
+ List<?> sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Dependency_4004, DependencyEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Dependency_4010(Package container) {
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ for (Iterator<?> links = container.getPackagedElements()
+ .iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Dependency) {
+ continue;
+ }
+ Dependency link = (Dependency) linkObject;
+ if (DependencyBranchEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List<?> targets = link.getSuppliers();
+ Object theTarget = targets.size() == 1 ? targets.get(0) : null;
+ if (false == theTarget instanceof NamedElement) {
+ continue;
+ }
+ NamedElement dst = (NamedElement) theTarget;
+ List<?> sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Dependency_4010, DependencyBranchEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected Collection<UMLLinkDescriptor> getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(Element target, CrossReferenceAdapter crossReferencer) {
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target);
+ for (EStructuralFeature.Setting setting : settings) {
+ if (setting.getEStructuralFeature() == UMLPackage.eINSTANCE.getComment_AnnotatedElement()) {
+ result.add(new UMLLinkDescriptor(setting.getEObject(), target, UMLElementTypes.CommentAnnotatedElement_4008, CommentAnnotatedElementEditPart.VISUAL_ID));
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected Collection<UMLLinkDescriptor> getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(Element target, CrossReferenceAdapter crossReferencer) {
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target);
+ for (EStructuralFeature.Setting setting : settings) {
+ if (setting.getEStructuralFeature() == UMLPackage.eINSTANCE.getConstraint_ConstrainedElement()) {
+ result.add(new UMLLinkDescriptor(setting.getEObject(), target, UMLElementTypes.ConstraintConstrainedElement_4009, ConstraintConstrainedElementEditPart.VISUAL_ID));
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Deployment_4001(NamedElement target, CrossReferenceAdapter crossReferencer) {
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target);
+ for (EStructuralFeature.Setting setting : settings) {
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getDependency_Supplier() || false == setting.getEObject() instanceof Deployment) {
+ continue;
+ }
+ Deployment link = (Deployment) setting.getEObject();
+ if (DeploymentEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List<?> sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Deployment_4001, DeploymentEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Manifestation_4002(NamedElement target, CrossReferenceAdapter crossReferencer) {
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target);
+ for (EStructuralFeature.Setting setting : settings) {
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getDependency_Supplier() || false == setting.getEObject() instanceof Manifestation) {
+ continue;
+ }
+ Manifestation link = (Manifestation) setting.getEObject();
+ if (ManifestationEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List<?> sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Manifestation_4002, ManifestationEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Generalization_4003(Classifier target, CrossReferenceAdapter crossReferencer) {
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(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;
+ }
+ Classifier src = link.getSpecific();
+ result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Generalization_4003, GeneralizationEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Dependency_4004(NamedElement target, CrossReferenceAdapter crossReferencer) {
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target);
+ for (EStructuralFeature.Setting setting : settings) {
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getDependency_Supplier() || false == setting.getEObject() instanceof Dependency) {
+ continue;
+ }
+ Dependency link = (Dependency) setting.getEObject();
+ if (DependencyEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List<?> sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Dependency_4004, DependencyEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected Collection<UMLLinkDescriptor> getIncomingTypeModelFacetLinks_Dependency_4010(NamedElement target, CrossReferenceAdapter crossReferencer) {
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ Collection<EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target);
+ for (EStructuralFeature.Setting setting : settings) {
+ if (setting.getEStructuralFeature() != UMLPackage.eINSTANCE.getDependency_Supplier() || false == setting.getEObject() instanceof Dependency) {
+ continue;
+ }
+ Dependency link = (Dependency) setting.getEObject();
+ if (DependencyBranchEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List<?> sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ result.add(new UMLLinkDescriptor(src, target, link, UMLElementTypes.Dependency_4010, DependencyBranchEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected Collection<UMLLinkDescriptor> getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(Comment source) {
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ for (Iterator<?> destinations = source.getAnnotatedElements()
+ .iterator(); destinations.hasNext();) {
+ Element destination = (Element) destinations.next();
+ result.add(new UMLLinkDescriptor(source, destination, UMLElementTypes.CommentAnnotatedElement_4008, CommentAnnotatedElementEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected Collection<UMLLinkDescriptor> getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(Constraint source) {
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ for (Iterator<?> destinations = source.getConstrainedElements()
+ .iterator(); destinations.hasNext();) {
+ Element destination = (Element) destinations.next();
+ result.add(new UMLLinkDescriptor(source, destination, UMLElementTypes.ConstraintConstrainedElement_4009, ConstraintConstrainedElementEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Deployment_4001(NamedElement source) {
+ DeploymentTarget 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 DeploymentTarget) {
+ container = (DeploymentTarget) element;
+ }
+ }
+ if (container == null) {
+ return Collections.emptyList();
+ }
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ for (Iterator<?> links = container.getDeployments()
+ .iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Deployment) {
+ continue;
+ }
+ Deployment link = (Deployment) linkObject;
+ if (DeploymentEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List<?> targets = link.getSuppliers();
+ Object theTarget = targets.size() == 1 ? targets.get(0) : null;
+ if (false == theTarget instanceof NamedElement) {
+ continue;
+ }
+ NamedElement dst = (NamedElement) theTarget;
+ List<?> sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ if (src != source) {
+ continue;
+ }
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Deployment_4001, DeploymentEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Manifestation_4002(NamedElement source) {
+ Artifact 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 Artifact) {
+ container = (Artifact) element;
+ }
+ }
+ if (container == null) {
+ return Collections.emptyList();
+ }
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ for (Iterator<?> links = container.getManifestations()
+ .iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Manifestation) {
+ continue;
+ }
+ Manifestation link = (Manifestation) linkObject;
+ if (ManifestationEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List<?> targets = link.getSuppliers();
+ Object theTarget = targets.size() == 1 ? targets.get(0) : null;
+ if (false == theTarget instanceof NamedElement) {
+ continue;
+ }
+ NamedElement dst = (NamedElement) theTarget;
+ List<?> sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ if (src != source) {
+ continue;
+ }
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Manifestation_4002, ManifestationEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Generalization_4003(Classifier source) {
+ Classifier 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 Classifier) {
+ container = (Classifier) element;
+ }
+ }
+ if (container == null) {
+ return Collections.emptyList();
+ }
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ 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();
+ Classifier src = link.getSpecific();
+ if (src != source) {
+ continue;
+ }
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Generalization_4003, GeneralizationEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Dependency_4004(NamedElement source) {
+ Package 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 Package) {
+ container = (Package) element;
+ }
+ }
+ if (container == null) {
+ return Collections.emptyList();
+ }
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ for (Iterator<?> links = container.getPackagedElements()
+ .iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Dependency) {
+ continue;
+ }
+ Dependency link = (Dependency) linkObject;
+ if (DependencyEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List<?> targets = link.getSuppliers();
+ Object theTarget = targets.size() == 1 ? targets.get(0) : null;
+ if (false == theTarget instanceof NamedElement) {
+ continue;
+ }
+ NamedElement dst = (NamedElement) theTarget;
+ List<?> sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ if (src != source) {
+ continue;
+ }
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Dependency_4004, DependencyEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected Collection<UMLLinkDescriptor> getOutgoingTypeModelFacetLinks_Dependency_4010(NamedElement source) {
+ Package 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 Package) {
+ container = (Package) element;
+ }
+ }
+ if (container == null) {
+ return Collections.emptyList();
+ }
+ LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
+ for (Iterator<?> links = container.getPackagedElements()
+ .iterator(); links.hasNext();) {
+ EObject linkObject = (EObject) links.next();
+ if (false == linkObject instanceof Dependency) {
+ continue;
+ }
+ Dependency link = (Dependency) linkObject;
+ if (DependencyBranchEditPart.VISUAL_ID != UMLVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ List<?> targets = link.getSuppliers();
+ Object theTarget = targets.size() == 1 ? targets.get(0) : null;
+ if (false == theTarget instanceof NamedElement) {
+ continue;
+ }
+ NamedElement dst = (NamedElement) theTarget;
+ List<?> sources = link.getClients();
+ Object theSource = sources.size() == 1 ? sources.get(0) : null;
+ if (false == theSource instanceof NamedElement) {
+ continue;
+ }
+ NamedElement src = (NamedElement) theSource;
+ if (src != source) {
+ continue;
+ }
+ result.add(new UMLLinkDescriptor(src, dst, link, UMLElementTypes.Dependency_4010, DependencyBranchEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDocumentProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDocumentProvider.java
index e7534cca481..2733ec4e4b5 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDocumentProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDocumentProvider.java
@@ -1,1033 +1,1033 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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
- */
- @Override
- 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
- */
- @Override
- 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;
- }
-
- /**
- * 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
- */
- 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
- */
- @Override
- protected IDocument createEmptyDocument() {
- DiagramDocument document = new DiagramDocument();
- document.setEditingDomain(createEditingDomain());
- return document;
- }
-
- /**
- * @generated
- */
- private TransactionalEditingDomain createEditingDomain() {
- TransactionalEditingDomain editingDomain = DiagramEditingDomainFactory.getInstance().createEditingDomain();
- editingDomain.setID("org.eclipse.papyrus.uml.diagram.deployment.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;
-
- @Override
- public Notifier getTarget() {
- return myTarger;
- }
-
- @Override
- public boolean isAdapterForType(Object type) {
- return false;
- }
-
- @Override
- public void notifyChanged(Notification notification) {
- if (diagramResourceModifiedFilter.matches(notification)) {
- Object value = notification.getNewValue();
- if (value instanceof Resource) {
- ((Resource) value).setTrackingModification(true);
- }
- }
- }
-
- @Override
- public void setTarget(Notifier newTarget) {
- myTarger = newTarget;
- }
-
- });
-
- return editingDomain;
- }
-
- /**
- * @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 {
- @SuppressWarnings({ "rawtypes", "unchecked" })
- 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(rootElement);
- return;
- }
- } else {
- for (Iterator<EObject> it = resource.getContents().iterator(); it.hasNext();) {
- Object rootElement = it.next();
- if (rootElement instanceof Diagram) {
- document.setContent(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));
- }
- }
-
- /**
- * @generated
- */
- @Override
- public long getModificationStamp(Object element) {
- ResourceSetInfo info = getResourceSetInfo(element);
- if (info != null) {
- return computeModificationStamp(info);
- }
- return super.getModificationStamp(element);
- }
-
- /**
- * @generated
- */
- @Override
- 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 ResourceSetInfo getResourceSetInfo(Object editorInput) {
- return (ResourceSetInfo) super.getElementInfo(editorInput);
- }
-
- /**
- * @generated
- */
- @Override
- protected void disposeElementInfo(Object element, ElementInfo info) {
- if (info instanceof ResourceSetInfo) {
- ResourceSetInfo resourceSetInfo = (ResourceSetInfo) info;
- resourceSetInfo.dispose();
- }
- super.disposeElementInfo(element, info);
- }
-
- /**
- * @generated
- */
- @Override
- 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(files2Validate.toArray(new IFile[files2Validate.size()]), computationContext);
- }
-
- super.doValidateState(element, computationContext);
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- 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
- */
- 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;
- }
- }
-
- /**
- * @generated
- */
- @Override
- protected void doUpdateStateCache(Object element) throws CoreException {
- ResourceSetInfo info = getResourceSetInfo(element);
- if (info != null) {
- info.setUpdateCache(true);
- }
- super.doUpdateStateCache(element);
- }
-
- /**
- * @generated
- */
- @Override
- public boolean isSynchronized(Object element) {
- ResourceSetInfo info = getResourceSetInfo(element);
- if (info != null) {
- return info.isSynchronized();
- }
- return super.isSynchronized(element);
- }
-
- /**
- * @generated
- */
- @Override
- 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(rules.toArray(new ISchedulingRule[rules.size()]));
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- 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(rules.toArray(new ISchedulingRule[rules.size()]));
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- 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(rules.toArray(new ISchedulingRule[rules.size()]));
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- 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(files.toArray(new IFile[files.size()]));
- }
- return null;
- }
-
- /**
- * @generated
- */
- private ISchedulingRule computeSchedulingRule(IResource toCreateOrModify) {
- if (toCreateOrModify.exists()) {
- return ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(toCreateOrModify);
- }
- IResource parent = toCreateOrModify;
- do {
- /*
- * XXX This is a workaround for
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=67601
- * IResourceRuleFactory.createRule should iterate the hierarchy
- * itself.
- */
- toCreateOrModify = parent;
- parent = toCreateOrModify.getParent();
- } while (parent != null && !parent.exists());
-
- return ResourcesPlugin.getWorkspace().getRuleFactory().createRule(toCreateOrModify);
- }
-
- /**
- * @generated
- */
- @Override
- protected void doSynchronize(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
- */
- @Override
- 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 = EcoreUtil.copy(diagramDocument.getDiagram());
- try {
- new AbstractTransactionalCommand(diagramDocument.getEditingDomain(), NLS.bind(Messages.UMLDocumentProvider_SaveAsOperation, diagramCopy.getName()), affectedFiles) {
- @Override
- 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 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
- */
- @Override
- public IEditorInput createInputWithEditingDomain(IEditorInput editorInput, TransactionalEditingDomain domain) {
- return editorInput;
- }
-
- /**
- * @generated
- */
- @Override
- public IDiagramDocument getDiagramDocument(Object element) {
- IDocument doc = getDocument(element);
- if (doc instanceof IDiagramDocument) {
- return (IDiagramDocument) doc;
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- protected IRunnableContext getOperationRunner(IProgressMonitor monitor) {
- return null;
- }
-
- /**
- * @generated
- */
- protected class ResourceSetInfo extends ElementInfo {
-
- /**
- * @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 long getModificationStamp() {
- return myModificationStamp;
- }
-
- /**
- * @generated
- */
- public void setModificationStamp(long modificationStamp) {
- myModificationStamp = modificationStamp;
- }
-
- /**
- * @generated
- */
- public TransactionalEditingDomain getEditingDomain() {
- return myDocument.getEditingDomain();
- }
-
- /**
- * @generated
- */
- public ResourceSet getResourceSet() {
- return getEditingDomain().getResourceSet();
- }
-
- /**
- * @generated
- */
- public Iterator<Resource> getLoadedResourcesIterator() {
- return new ArrayList<Resource>(getResourceSet().getResources()).iterator();
- }
-
- /**
- * @generated
- */
- public IEditorInput getEditorInput() {
- return myEditorInput;
- }
-
- /**
- * @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 boolean isSynchronized() {
- return myUnSynchronizedResources.size() == 0;
- }
-
- /**
- * @generated
- */
- public void setUnSynchronized(Resource resource) {
- myUnSynchronizedResources.add(resource);
- }
-
- /**
- * @generated
- */
- public void setSynchronized(Resource resource) {
- myUnSynchronizedResources.remove(resource);
- }
-
- /**
- * @generated
- */
- public final void stopResourceListening() {
- mySynchronizer.dispose();
- mySynchronizer = null;
- }
-
- /**
- * @generated
- */
- public final void startResourceListening() {
- mySynchronizer = new WorkspaceSynchronizer(getEditingDomain(), new SynchronizerDelegate());
- }
-
- /**
- * @generated
- */
- public boolean isUpdateCache() {
- return myUpdateCache;
- }
-
- /**
- * @generated
- */
- public void setUpdateCache(boolean update) {
- myUpdateCache = update;
- }
-
- /**
- * @generated
- */
- public boolean isModifiable() {
- return myModifiable;
- }
-
- /**
- * @generated
- */
- public void setModifiable(boolean modifiable) {
- myModifiable = modifiable;
- }
-
- /**
- * @generated
- */
- public boolean isReadOnly() {
- return myReadOnly;
- }
-
- /**
- * @generated
- */
- public void setReadOnly(boolean readOnly) {
- myReadOnly = readOnly;
- }
-
- /**
- * @generated
- */
- private class SynchronizerDelegate implements WorkspaceSynchronizer.Delegate {
-
- /**
- * @generated
- */
- @Override
- public void dispose() {
- }
-
- /**
- * @generated
- */
- @Override
- public boolean handleResourceChanged(final Resource resource) {
- synchronized (ResourceSetInfo.this) {
- if (ResourceSetInfo.this.fCanBeSaved) {
- ResourceSetInfo.this.setUnSynchronized(resource);
- return true;
- }
- }
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- handleElementChanged(ResourceSetInfo.this, resource, null);
- }
- });
- return true;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean handleResourceDeleted(Resource resource) {
- synchronized (ResourceSetInfo.this) {
- if (ResourceSetInfo.this.fCanBeSaved) {
- ResourceSetInfo.this.setUnSynchronized(resource);
- return true;
- }
- }
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- fireElementDeleted(ResourceSetInfo.this.getEditorInput());
- }
- });
- return true;
- }
-
- /**
- * @generated
- */
- @Override
- 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() {
- @Override
- public void run() {
- handleElementMoved(ResourceSetInfo.this.getEditorInput(), newURI);
- }
- });
- } else {
- handleResourceDeleted(resource);
- }
- return true;
- }
- }
- }
-
- /**
- * @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
- */
- @Override
- 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<Resource> it = myInfo.getLoadedResourcesIterator(); it.hasNext() && !modified;) {
- Resource nextResource = 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));
- }
- }
- }
- }
- }
- }
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.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
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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;
+ }
+
+ /**
+ * 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
+ */
+ 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
+ */
+ @Override
+ protected IDocument createEmptyDocument() {
+ DiagramDocument document = new DiagramDocument();
+ document.setEditingDomain(createEditingDomain());
+ return document;
+ }
+
+ /**
+ * @generated
+ */
+ private TransactionalEditingDomain createEditingDomain() {
+ TransactionalEditingDomain editingDomain = DiagramEditingDomainFactory.getInstance().createEditingDomain();
+ editingDomain.setID("org.eclipse.papyrus.uml.diagram.deployment.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;
+
+ @Override
+ public Notifier getTarget() {
+ return myTarger;
+ }
+
+ @Override
+ public boolean isAdapterForType(Object type) {
+ return false;
+ }
+
+ @Override
+ public void notifyChanged(Notification notification) {
+ if (diagramResourceModifiedFilter.matches(notification)) {
+ Object value = notification.getNewValue();
+ if (value instanceof Resource) {
+ ((Resource) value).setTrackingModification(true);
+ }
+ }
+ }
+
+ @Override
+ public void setTarget(Notifier newTarget) {
+ myTarger = newTarget;
+ }
+
+ });
+
+ return editingDomain;
+ }
+
+ /**
+ * @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 {
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ 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(rootElement);
+ return;
+ }
+ } else {
+ for (Iterator<EObject> it = resource.getContents().iterator(); it.hasNext();) {
+ Object rootElement = it.next();
+ if (rootElement instanceof Diagram) {
+ document.setContent(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));
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public long getModificationStamp(Object element) {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ return computeModificationStamp(info);
+ }
+ return super.getModificationStamp(element);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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 ResourceSetInfo getResourceSetInfo(Object editorInput) {
+ return (ResourceSetInfo) super.getElementInfo(editorInput);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void disposeElementInfo(Object element, ElementInfo info) {
+ if (info instanceof ResourceSetInfo) {
+ ResourceSetInfo resourceSetInfo = (ResourceSetInfo) info;
+ resourceSetInfo.dispose();
+ }
+ super.disposeElementInfo(element, info);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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(files2Validate.toArray(new IFile[files2Validate.size()]), computationContext);
+ }
+
+ super.doValidateState(element, computationContext);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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
+ */
+ 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;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void doUpdateStateCache(Object element) throws CoreException {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ info.setUpdateCache(true);
+ }
+ super.doUpdateStateCache(element);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean isSynchronized(Object element) {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ return info.isSynchronized();
+ }
+ return super.isSynchronized(element);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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(rules.toArray(new ISchedulingRule[rules.size()]));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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(rules.toArray(new ISchedulingRule[rules.size()]));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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(rules.toArray(new ISchedulingRule[rules.size()]));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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(files.toArray(new IFile[files.size()]));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private ISchedulingRule computeSchedulingRule(IResource toCreateOrModify) {
+ if (toCreateOrModify.exists()) {
+ return ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(toCreateOrModify);
+ }
+ IResource parent = toCreateOrModify;
+ do {
+ /*
+ * XXX This is a workaround for
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=67601
+ * IResourceRuleFactory.createRule should iterate the hierarchy
+ * itself.
+ */
+ toCreateOrModify = parent;
+ parent = toCreateOrModify.getParent();
+ } while (parent != null && !parent.exists());
+
+ return ResourcesPlugin.getWorkspace().getRuleFactory().createRule(toCreateOrModify);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected void doSynchronize(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
+ */
+ @Override
+ 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 = EcoreUtil.copy(diagramDocument.getDiagram());
+ try {
+ new AbstractTransactionalCommand(diagramDocument.getEditingDomain(), NLS.bind(Messages.UMLDocumentProvider_SaveAsOperation, diagramCopy.getName()), affectedFiles) {
+ @Override
+ 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 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
+ */
+ @Override
+ public IEditorInput createInputWithEditingDomain(IEditorInput editorInput, TransactionalEditingDomain domain) {
+ return editorInput;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IDiagramDocument getDiagramDocument(Object element) {
+ IDocument doc = getDocument(element);
+ if (doc instanceof IDiagramDocument) {
+ return (IDiagramDocument) doc;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected IRunnableContext getOperationRunner(IProgressMonitor monitor) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected class ResourceSetInfo extends ElementInfo {
+
+ /**
+ * @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 long getModificationStamp() {
+ return myModificationStamp;
+ }
+
+ /**
+ * @generated
+ */
+ public void setModificationStamp(long modificationStamp) {
+ myModificationStamp = modificationStamp;
+ }
+
+ /**
+ * @generated
+ */
+ public TransactionalEditingDomain getEditingDomain() {
+ return myDocument.getEditingDomain();
+ }
+
+ /**
+ * @generated
+ */
+ public ResourceSet getResourceSet() {
+ return getEditingDomain().getResourceSet();
+ }
+
+ /**
+ * @generated
+ */
+ public Iterator<Resource> getLoadedResourcesIterator() {
+ return new ArrayList<Resource>(getResourceSet().getResources()).iterator();
+ }
+
+ /**
+ * @generated
+ */
+ public IEditorInput getEditorInput() {
+ return myEditorInput;
+ }
+
+ /**
+ * @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 boolean isSynchronized() {
+ return myUnSynchronizedResources.size() == 0;
+ }
+
+ /**
+ * @generated
+ */
+ public void setUnSynchronized(Resource resource) {
+ myUnSynchronizedResources.add(resource);
+ }
+
+ /**
+ * @generated
+ */
+ public void setSynchronized(Resource resource) {
+ myUnSynchronizedResources.remove(resource);
+ }
+
+ /**
+ * @generated
+ */
+ public final void stopResourceListening() {
+ mySynchronizer.dispose();
+ mySynchronizer = null;
+ }
+
+ /**
+ * @generated
+ */
+ public final void startResourceListening() {
+ mySynchronizer = new WorkspaceSynchronizer(getEditingDomain(), new SynchronizerDelegate());
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isUpdateCache() {
+ return myUpdateCache;
+ }
+
+ /**
+ * @generated
+ */
+ public void setUpdateCache(boolean update) {
+ myUpdateCache = update;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isModifiable() {
+ return myModifiable;
+ }
+
+ /**
+ * @generated
+ */
+ public void setModifiable(boolean modifiable) {
+ myModifiable = modifiable;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isReadOnly() {
+ return myReadOnly;
+ }
+
+ /**
+ * @generated
+ */
+ public void setReadOnly(boolean readOnly) {
+ myReadOnly = readOnly;
+ }
+
+ /**
+ * @generated
+ */
+ private class SynchronizerDelegate implements WorkspaceSynchronizer.Delegate {
+
+ /**
+ * @generated
+ */
+ @Override
+ public void dispose() {
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean handleResourceChanged(final Resource resource) {
+ synchronized (ResourceSetInfo.this) {
+ if (ResourceSetInfo.this.fCanBeSaved) {
+ ResourceSetInfo.this.setUnSynchronized(resource);
+ return true;
+ }
+ }
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ handleElementChanged(ResourceSetInfo.this, resource, null);
+ }
+ });
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean handleResourceDeleted(Resource resource) {
+ synchronized (ResourceSetInfo.this) {
+ if (ResourceSetInfo.this.fCanBeSaved) {
+ ResourceSetInfo.this.setUnSynchronized(resource);
+ return true;
+ }
+ }
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ fireElementDeleted(ResourceSetInfo.this.getEditorInput());
+ }
+ });
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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() {
+ @Override
+ public void run() {
+ handleElementMoved(ResourceSetInfo.this.getEditorInput(), newURI);
+ }
+ });
+ } else {
+ handleResourceDeleted(resource);
+ }
+ return true;
+ }
+ }
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ 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<Resource> it = myInfo.getLoadedResourcesIterator(); it.hasNext() && !modified;) {
+ Resource nextResource = 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));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLInitDiagramFileAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLInitDiagramFileAction.java
index 72152b27c25..9ed31ca51c8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLInitDiagramFileAction.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLInitDiagramFileAction.java
@@ -1,107 +1,105 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.part;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.common.util.WrappedException;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart;
-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
- */
- @Override
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- this.targetPart = targetPart;
- }
-
- /**
- * @generated
- */
- @Override
- 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
- */
- private Shell getShell() {
- return targetPart.getSite().getShell();
- }
-
- /**
- * @generated
- */
- @Override
- public void run(IAction action) {
- TransactionalEditingDomain editingDomain =
- WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain();
- ResourceSet resourceSet = editingDomain.getResourceSet();
- EObject diagramRoot = null;
- try {
- Resource resource = resourceSet.getResource(domainModelURI, true);
- diagramRoot = 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,
- DeploymentDiagramEditPart.MODEL_ID));
- UMLDiagramEditorUtil.runWizard(getShell(), wizard, "InitDiagramFile"); //$NON-NLS-1$
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.part;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.common.util.WrappedException;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart;
+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
+ */
+ @Override
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ this.targetPart = targetPart;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ private Shell getShell() {
+ return targetPart.getSite().getShell();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void run(IAction action) {
+ TransactionalEditingDomain editingDomain = WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain();
+ ResourceSet resourceSet = editingDomain.getResourceSet();
+ EObject diagramRoot = null;
+ try {
+ Resource resource = resourceSet.getResource(domainModelURI, true);
+ diagramRoot = 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,
+ DeploymentDiagramEditPart.MODEL_ID));
+ UMLDiagramEditorUtil.runWizard(getShell(), wizard, "InitDiagramFile"); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLLinkDescriptor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLLinkDescriptor.java
index cfae49cb2c5..8ae2dd6c03c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLLinkDescriptor.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLLinkDescriptor.java
@@ -1,36 +1,36 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.part;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.tooling.runtime.update.UpdaterLinkDescriptor;
-
-/**
- * @generated
- */
-public class UMLLinkDescriptor extends UpdaterLinkDescriptor {
-
- /**
- * @generated
- */
- public UMLLinkDescriptor(EObject source, EObject destination, IElementType elementType, int linkVID) {
- super(source, destination, elementType, linkVID);
- }
-
- /**
- * @generated
- */
- public UMLLinkDescriptor(EObject source, EObject destination, EObject linkElement, IElementType elementType, int linkVID) {
- super(source, destination, linkElement, elementType, linkVID);
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.part;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.tooling.runtime.update.UpdaterLinkDescriptor;
+
+/**
+ * @generated
+ */
+public class UMLLinkDescriptor extends UpdaterLinkDescriptor {
+
+ /**
+ * @generated
+ */
+ public UMLLinkDescriptor(EObject source, EObject destination, IElementType elementType, int linkVID) {
+ super(source, destination, elementType, linkVID);
+ }
+
+ /**
+ * @generated
+ */
+ public UMLLinkDescriptor(EObject source, EObject destination, EObject linkElement, IElementType elementType, int linkVID) {
+ super(source, destination, linkElement, elementType, linkVID);
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLMatchingStrategy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLMatchingStrategy.java
index 1631524112a..fb5bc73e394 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLMatchingStrategy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLMatchingStrategy.java
@@ -1,45 +1,45 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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
- */
- @Override
- 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;
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.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
+ */
+ @Override
+ 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/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLNewDiagramFileWizard.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLNewDiagramFileWizard.java
index bd7033d1f6d..21ac9289559 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLNewDiagramFileWizard.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLNewDiagramFileWizard.java
@@ -1,194 +1,193 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.part;
-
-import java.io.IOException;
-import java.util.LinkedList;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
-import org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
-
-/**
- * @generated
- */
-public class UMLNewDiagramFileWizard extends Wizard {
-
- /**
- * @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,
- DeploymentDiagramEditPart.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, "PapyrusUMLDeployment_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
- */
- @Override
- public void addPages() {
- addPage(myFileCreationPage);
- addPage(diagramRootElementSelectionPage);
- }
-
- /**
- * @generated
- */
- @Override
- 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) {
-
- @Override
- protected CommandResult doExecuteWithResult(
- IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- int diagramVID = UMLVisualIDRegistry.getDiagramVisualID(diagramRootElementSelectionPage.getModelElement());
- if (diagramVID != DeploymentDiagramEditPart.VISUAL_ID) {
- return CommandResult.newErrorCommandResult(
- Messages.UMLNewDiagramFileWizard_IncorrectRootError);
- }
- Diagram diagram =
- ViewService.createDiagram(
- diagramRootElementSelectionPage.getModelElement(), DeploymentDiagramEditPart.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;
- }
-
- /**
- * @generated
- */
- private static class DiagramRootElementSelectionPage extends ModelElementSelectionPage {
-
- /**
- * @generated
- */
- protected DiagramRootElementSelectionPage(String pageName) {
- super(pageName);
- }
-
- /**
- * @generated
- */
- @Override
- protected String getSelectionTitle() {
- return Messages.UMLNewDiagramFileWizard_RootSelectionPageSelectionTitle;
- }
-
- /**
- * @generated
- */
- @Override
- protected boolean validatePage() {
- if (getModelElement() == null) {
- setErrorMessage(Messages.UMLNewDiagramFileWizard_RootSelectionPageNoSelectionMessage);
- return false;
- }
- boolean result = ViewService.getInstance().provides(
- new CreateDiagramViewOperation(
- new EObjectAdapter(getModelElement()),
- DeploymentDiagramEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT));
- setErrorMessage(result ? null : Messages.UMLNewDiagramFileWizard_RootSelectionPageInvalidSelectionMessage);
- return result;
- }
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.part;
+
+import java.io.IOException;
+import java.util.LinkedList;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.OperationHistoryFactory;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+
+/**
+ * @generated
+ */
+public class UMLNewDiagramFileWizard extends Wizard {
+
+ /**
+ * @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,
+ DeploymentDiagramEditPart.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, "PapyrusUMLDeployment_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
+ */
+ @Override
+ public void addPages() {
+ addPage(myFileCreationPage);
+ addPage(diagramRootElementSelectionPage);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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) {
+
+ @Override
+ protected CommandResult doExecuteWithResult(
+ IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ int diagramVID = UMLVisualIDRegistry.getDiagramVisualID(diagramRootElementSelectionPage.getModelElement());
+ if (diagramVID != DeploymentDiagramEditPart.VISUAL_ID) {
+ return CommandResult.newErrorCommandResult(
+ Messages.UMLNewDiagramFileWizard_IncorrectRootError);
+ }
+ Diagram diagram = ViewService.createDiagram(
+ diagramRootElementSelectionPage.getModelElement(), DeploymentDiagramEditPart.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;
+ }
+
+ /**
+ * @generated
+ */
+ private static class DiagramRootElementSelectionPage extends ModelElementSelectionPage {
+
+ /**
+ * @generated
+ */
+ protected DiagramRootElementSelectionPage(String pageName) {
+ super(pageName);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getSelectionTitle() {
+ return Messages.UMLNewDiagramFileWizard_RootSelectionPageSelectionTitle;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected boolean validatePage() {
+ if (getModelElement() == null) {
+ setErrorMessage(Messages.UMLNewDiagramFileWizard_RootSelectionPageNoSelectionMessage);
+ return false;
+ }
+ boolean result = ViewService.getInstance().provides(
+ new CreateDiagramViewOperation(
+ new EObjectAdapter(getModelElement()),
+ DeploymentDiagramEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT));
+ setErrorMessage(result ? null : Messages.UMLNewDiagramFileWizard_RootSelectionPageInvalidSelectionMessage);
+ return result;
+ }
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLNodeDescriptor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLNodeDescriptor.java
index 00f9037a9ad..5523e5a08a5 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLNodeDescriptor.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLNodeDescriptor.java
@@ -1,28 +1,28 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.part;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.tooling.runtime.update.UpdaterNodeDescriptor;
-
-/**
- * @generated
- */
-public class UMLNodeDescriptor extends UpdaterNodeDescriptor {
-
- /**
- * @generated
- */
- public UMLNodeDescriptor(EObject modelElement, int visualID) {
- super(modelElement, visualID);
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.part;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.tooling.runtime.update.UpdaterNodeDescriptor;
+
+/**
+ * @generated
+ */
+public class UMLNodeDescriptor extends UpdaterNodeDescriptor {
+
+ /**
+ * @generated
+ */
+ public UMLNodeDescriptor(EObject modelElement, int visualID) {
+ super(modelElement, visualID);
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLPaletteFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLPaletteFactory.java
index e6269eddefc..111eb4f5edb 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLPaletteFactory.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLPaletteFactory.java
@@ -1,323 +1,323 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.part;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.gef.Tool;
-import org.eclipse.gmf.runtime.diagram.ui.services.palette.PaletteFactory;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeConnectionTool;
-import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeCreationTool;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-
-/**
- * @generated
- */
-public class UMLPaletteFactory extends PaletteFactory.Adapter {
-
- // RS: New Palette generation
- // Generates the ID for the tool elements
- // Generate the tool factory (if(ID) createtool...)
- /**
- * @generated
- */
- private final static String CREATEMODELCREATIONTOOL = "createModelCreationTool";//$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String DEPLOYMENT_TOOL_PACKAGE = "deployment.tool.package";//$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String DEPLOYMENT_TOOL_NODE = "deployment.tool.node";//$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String DEPLOYMENT_TOOL_DEVICE = "deployment.tool.device";//$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String DEPLOYMENT_TOOL_EXECUTIONENVIRONMENT = "deployment.tool.executionEnvironment";//$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String DEPLOYMENT_TOOL_ARTIFACT = "deployment.tool.artifact";//$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String DEPLOYMENT_TOOL_COMMENT = "deployment.tool.comment";//$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String DEPLOYMENT_TOOL_CONSTRAINT = "deployment.tool.constraint";//$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String DEPLOYMENT_TOOL_LINK = "deployment.tool.link";//$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String DEPLOYMENT_TOOL_DEPENDENCY = "deployment.tool.dependency";//$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String DEPLOYMENT_TOOL_DEPENDENCYBRANCH = "deployment.tool.dependencybranch";//$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String DEPLOYMENT_TOOL_GENERALIZATION = "deployment.tool.generalization";//$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String DEPLOYMENT_TOOL_DEPLOYMENT = "deployment.tool.deployment";//$NON-NLS-1$
-
- /**
- * @generated
- */
- private final static String DEPLOYMENT_TOOL_MANIFESTATION = "deployment.tool.manifestation";//$NON-NLS-1$
-
- /**
- * @generated
- */
- public UMLPaletteFactory() {
-
- }
-
- /**
- * @generated
- */
- @Override
- public Tool createTool(String toolId) {
- if (toolId.equals(DEPLOYMENT_TOOL_ARTIFACT)) {
- return createArtifactCreationTool();
- }
- if (toolId.equals(DEPLOYMENT_TOOL_COMMENT)) {
- return createCommentCreationTool();
- }
- if (toolId.equals(DEPLOYMENT_TOOL_CONSTRAINT)) {
- return createConstraintCreationTool();
- }
- if (toolId.equals(DEPLOYMENT_TOOL_DEVICE)) {
- return createDeviceCreationTool();
- }
- if (toolId.equals(DEPLOYMENT_TOOL_EXECUTIONENVIRONMENT)) {
- return createExecutionEnvironmentCreationTool();
- }
- if (toolId.equals(CREATEMODELCREATIONTOOL)) {
- return createModelCreationTool();
- }
- if (toolId.equals(DEPLOYMENT_TOOL_NODE)) {
- return createNodeCreationTool();
- }
- if (toolId.equals(DEPLOYMENT_TOOL_PACKAGE)) {
- return createPackageCreationTool();
- }
- if (toolId.equals(DEPLOYMENT_TOOL_DEPENDENCY)) {
- return createDependencyCreationTool();
- }
- if (toolId.equals(DEPLOYMENT_TOOL_DEPENDENCYBRANCH)) {
- return createDependencyBranchCreationTool();
- }
- if (toolId.equals(DEPLOYMENT_TOOL_DEPLOYMENT)) {
- return createDeploymentCreationTool();
- }
- if (toolId.equals(DEPLOYMENT_TOOL_GENERALIZATION)) {
- return createGeneralizationCreationTool();
- }
- if (toolId.equals(DEPLOYMENT_TOOL_LINK)) {
- return createLinkCreationTool();
- }
- if (toolId.equals(DEPLOYMENT_TOOL_MANIFESTATION)) {
- return createManifestationCreationTool();
- }
- // default return: null
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public Object getTemplate(String templateId) {
-
- // default return: null
- return null;
- }
-
- /**
- * @generated
- */
- private Tool createModelCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(2);
- types.add(UMLElementTypes.Model_49);
- types.add(UMLElementTypes.Model_2010);
- Tool tool = new AspectUnspecifiedTypeCreationTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createPackageCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(2);
- types.add(UMLElementTypes.Package_2009);
- types.add(UMLElementTypes.Package_36);
- Tool tool = new AspectUnspecifiedTypeCreationTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createNodeCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(3);
- types.add(UMLElementTypes.Node_2008);
- types.add(UMLElementTypes.Node_23);
- types.add(UMLElementTypes.Node_42);
- Tool tool = new AspectUnspecifiedTypeCreationTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createDeviceCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(3);
- types.add(UMLElementTypes.Device_2003);
- types.add(UMLElementTypes.Device_16);
- types.add(UMLElementTypes.Device_44);
- Tool tool = new AspectUnspecifiedTypeCreationTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createExecutionEnvironmentCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(3);
- types.add(UMLElementTypes.ExecutionEnvironment_2002);
- types.add(UMLElementTypes.ExecutionEnvironment_21);
- types.add(UMLElementTypes.ExecutionEnvironment_46);
- Tool tool = new AspectUnspecifiedTypeCreationTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createArtifactCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(4);
- types.add(UMLElementTypes.Artifact_2006);
- types.add(UMLElementTypes.Artifact_25);
- types.add(UMLElementTypes.Artifact_28);
- types.add(UMLElementTypes.Artifact_40);
- Tool tool = new AspectUnspecifiedTypeCreationTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createCommentCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(2);
- types.add(UMLElementTypes.Comment_2001);
- types.add(UMLElementTypes.Comment_54);
- Tool tool = new AspectUnspecifiedTypeCreationTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createConstraintCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(2);
- types.add(UMLElementTypes.Constraint_2005);
- types.add(UMLElementTypes.Constraint_56);
- Tool tool = new AspectUnspecifiedTypeCreationTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createLinkCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(2);
- types.add(UMLElementTypes.CommentAnnotatedElement_4008);
- types.add(UMLElementTypes.ConstraintConstrainedElement_4009);
- Tool tool = new AspectUnspecifiedTypeConnectionTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createDependencyCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Dependency_4004);
- Tool tool = new AspectUnspecifiedTypeConnectionTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createDependencyBranchCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Dependency_4010);
- Tool tool = new AspectUnspecifiedTypeConnectionTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createGeneralizationCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Generalization_4003);
- Tool tool = new AspectUnspecifiedTypeConnectionTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createDeploymentCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Deployment_4001);
- Tool tool = new AspectUnspecifiedTypeConnectionTool(types);
- return tool;
- }
-
- /**
- * @generated
- */
- private Tool createManifestationCreationTool() {
- List<IElementType> types = new ArrayList<IElementType>(1);
- types.add(UMLElementTypes.Manifestation_4002);
- Tool tool = new AspectUnspecifiedTypeConnectionTool(types);
- return tool;
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.part;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gef.Tool;
+import org.eclipse.gmf.runtime.diagram.ui.services.palette.PaletteFactory;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeConnectionTool;
+import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeCreationTool;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class UMLPaletteFactory extends PaletteFactory.Adapter {
+
+ // RS: New Palette generation
+ // Generates the ID for the tool elements
+ // Generate the tool factory (if(ID) createtool...)
+ /**
+ * @generated
+ */
+ private final static String CREATEMODELCREATIONTOOL = "createModelCreationTool";//$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private final static String DEPLOYMENT_TOOL_PACKAGE = "deployment.tool.package";//$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private final static String DEPLOYMENT_TOOL_NODE = "deployment.tool.node";//$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private final static String DEPLOYMENT_TOOL_DEVICE = "deployment.tool.device";//$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private final static String DEPLOYMENT_TOOL_EXECUTIONENVIRONMENT = "deployment.tool.executionEnvironment";//$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private final static String DEPLOYMENT_TOOL_ARTIFACT = "deployment.tool.artifact";//$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private final static String DEPLOYMENT_TOOL_COMMENT = "deployment.tool.comment";//$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private final static String DEPLOYMENT_TOOL_CONSTRAINT = "deployment.tool.constraint";//$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private final static String DEPLOYMENT_TOOL_LINK = "deployment.tool.link";//$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private final static String DEPLOYMENT_TOOL_DEPENDENCY = "deployment.tool.dependency";//$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private final static String DEPLOYMENT_TOOL_DEPENDENCYBRANCH = "deployment.tool.dependencybranch";//$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private final static String DEPLOYMENT_TOOL_GENERALIZATION = "deployment.tool.generalization";//$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private final static String DEPLOYMENT_TOOL_DEPLOYMENT = "deployment.tool.deployment";//$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private final static String DEPLOYMENT_TOOL_MANIFESTATION = "deployment.tool.manifestation";//$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public UMLPaletteFactory() {
+
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Tool createTool(String toolId) {
+ if (toolId.equals(DEPLOYMENT_TOOL_ARTIFACT)) {
+ return createArtifactCreationTool();
+ }
+ if (toolId.equals(DEPLOYMENT_TOOL_COMMENT)) {
+ return createCommentCreationTool();
+ }
+ if (toolId.equals(DEPLOYMENT_TOOL_CONSTRAINT)) {
+ return createConstraintCreationTool();
+ }
+ if (toolId.equals(DEPLOYMENT_TOOL_DEVICE)) {
+ return createDeviceCreationTool();
+ }
+ if (toolId.equals(DEPLOYMENT_TOOL_EXECUTIONENVIRONMENT)) {
+ return createExecutionEnvironmentCreationTool();
+ }
+ if (toolId.equals(CREATEMODELCREATIONTOOL)) {
+ return createModelCreationTool();
+ }
+ if (toolId.equals(DEPLOYMENT_TOOL_NODE)) {
+ return createNodeCreationTool();
+ }
+ if (toolId.equals(DEPLOYMENT_TOOL_PACKAGE)) {
+ return createPackageCreationTool();
+ }
+ if (toolId.equals(DEPLOYMENT_TOOL_DEPENDENCY)) {
+ return createDependencyCreationTool();
+ }
+ if (toolId.equals(DEPLOYMENT_TOOL_DEPENDENCYBRANCH)) {
+ return createDependencyBranchCreationTool();
+ }
+ if (toolId.equals(DEPLOYMENT_TOOL_DEPLOYMENT)) {
+ return createDeploymentCreationTool();
+ }
+ if (toolId.equals(DEPLOYMENT_TOOL_GENERALIZATION)) {
+ return createGeneralizationCreationTool();
+ }
+ if (toolId.equals(DEPLOYMENT_TOOL_LINK)) {
+ return createLinkCreationTool();
+ }
+ if (toolId.equals(DEPLOYMENT_TOOL_MANIFESTATION)) {
+ return createManifestationCreationTool();
+ }
+ // default return: null
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Object getTemplate(String templateId) {
+
+ // default return: null
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createModelCreationTool() {
+ List<IElementType> types = new ArrayList<IElementType>(2);
+ types.add(UMLElementTypes.Model_49);
+ types.add(UMLElementTypes.Model_2010);
+ Tool tool = new AspectUnspecifiedTypeCreationTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createPackageCreationTool() {
+ List<IElementType> types = new ArrayList<IElementType>(2);
+ types.add(UMLElementTypes.Package_2009);
+ types.add(UMLElementTypes.Package_36);
+ Tool tool = new AspectUnspecifiedTypeCreationTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createNodeCreationTool() {
+ List<IElementType> types = new ArrayList<IElementType>(3);
+ types.add(UMLElementTypes.Node_2008);
+ types.add(UMLElementTypes.Node_23);
+ types.add(UMLElementTypes.Node_42);
+ Tool tool = new AspectUnspecifiedTypeCreationTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createDeviceCreationTool() {
+ List<IElementType> types = new ArrayList<IElementType>(3);
+ types.add(UMLElementTypes.Device_2003);
+ types.add(UMLElementTypes.Device_16);
+ types.add(UMLElementTypes.Device_44);
+ Tool tool = new AspectUnspecifiedTypeCreationTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createExecutionEnvironmentCreationTool() {
+ List<IElementType> types = new ArrayList<IElementType>(3);
+ types.add(UMLElementTypes.ExecutionEnvironment_2002);
+ types.add(UMLElementTypes.ExecutionEnvironment_21);
+ types.add(UMLElementTypes.ExecutionEnvironment_46);
+ Tool tool = new AspectUnspecifiedTypeCreationTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createArtifactCreationTool() {
+ List<IElementType> types = new ArrayList<IElementType>(4);
+ types.add(UMLElementTypes.Artifact_2006);
+ types.add(UMLElementTypes.Artifact_25);
+ types.add(UMLElementTypes.Artifact_28);
+ types.add(UMLElementTypes.Artifact_40);
+ Tool tool = new AspectUnspecifiedTypeCreationTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createCommentCreationTool() {
+ List<IElementType> types = new ArrayList<IElementType>(2);
+ types.add(UMLElementTypes.Comment_2001);
+ types.add(UMLElementTypes.Comment_54);
+ Tool tool = new AspectUnspecifiedTypeCreationTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createConstraintCreationTool() {
+ List<IElementType> types = new ArrayList<IElementType>(2);
+ types.add(UMLElementTypes.Constraint_2005);
+ types.add(UMLElementTypes.Constraint_56);
+ Tool tool = new AspectUnspecifiedTypeCreationTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createLinkCreationTool() {
+ List<IElementType> types = new ArrayList<IElementType>(2);
+ types.add(UMLElementTypes.CommentAnnotatedElement_4008);
+ types.add(UMLElementTypes.ConstraintConstrainedElement_4009);
+ Tool tool = new AspectUnspecifiedTypeConnectionTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createDependencyCreationTool() {
+ List<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Dependency_4004);
+ Tool tool = new AspectUnspecifiedTypeConnectionTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createDependencyBranchCreationTool() {
+ List<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Dependency_4010);
+ Tool tool = new AspectUnspecifiedTypeConnectionTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createGeneralizationCreationTool() {
+ List<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Generalization_4003);
+ Tool tool = new AspectUnspecifiedTypeConnectionTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createDeploymentCreationTool() {
+ List<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Deployment_4001);
+ Tool tool = new AspectUnspecifiedTypeConnectionTool(types);
+ return tool;
+ }
+
+ /**
+ * @generated
+ */
+ private Tool createManifestationCreationTool() {
+ List<IElementType> types = new ArrayList<IElementType>(1);
+ types.add(UMLElementTypes.Manifestation_4002);
+ Tool tool = new AspectUnspecifiedTypeConnectionTool(types);
+ return tool;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLVisualIDRegistry.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLVisualIDRegistry.java
index bef759ce652..aef0b049c7a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLVisualIDRegistry.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLVisualIDRegistry.java
@@ -1,997 +1,997 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.part;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.tooling.runtime.structure.DiagramStructure;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactCompositeCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactCompositeCompartmentEditPartACN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactCompositeCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPartACN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartACN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPartACN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentBodyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentBodyEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintSpecificationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintSpecificationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DefaultNamedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DefaultNamedElementNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNodeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceCompositeCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceCompositeCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentCompositeCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentCompositeCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelPackageableElementCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelPackageableElementCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.MultiDependencyLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedArtifactNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedArtifactNodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedDeviceEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedDeviceNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedExecutionEnvironmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedExecutionEnvironmentNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedNodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedNodeNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeCompositeCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeCompositeCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackagePackageableElementCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackagePackageableElementCompartmentEditPartCN;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * This registry is used to determine which type of visual object should be
- * created for the corresponding Diagram, Node, ChildNode or Link represented
- * by a domain model object.
- *
- * @generated
- */
-public class UMLVisualIDRegistry {
-
- /**
- * @generated
- */
- private static final String DEBUG_KEY = "org.eclipse.papyrus.uml.diagram.deployment/debug/visualID"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static int getVisualID(View view) {
- if (view instanceof Diagram) {
- if (DeploymentDiagramEditPart.MODEL_ID.equals(view.getType())) {
- return DeploymentDiagramEditPart.VISUAL_ID;
- } else {
- return -1;
- }
- }
- return org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getVisualID(view.getType());
- }
-
- /**
- * @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 annotation.getDetails().get("modelID"); //$NON-NLS-1$
- }
- view = (View) view.eContainer();
- }
- return diagram != null ? diagram.getType() : null;
- }
-
- /**
- * @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 String getType(int visualID) {
- return Integer.toString(visualID);
- }
-
- /**
- * @generated
- */
- public static int getDiagramVisualID(EObject domainElement) {
- if (domainElement == null) {
- return -1;
- }
- return 1000;
- }
-
- /**
- * @generated
- */
- public static int getNodeVisualID(View containerView, EObject domainElement) {
- if (domainElement == null) {
- return -1;
- }
- String containerModelID = org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getModelID(containerView);
- if (!DeploymentDiagramEditPart.MODEL_ID.equals(containerModelID)) {
- return -1;
- }
- int containerVisualID;
- if (DeploymentDiagramEditPart.MODEL_ID.equals(containerModelID)) {
- containerVisualID = org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getVisualID(containerView);
- } else {
- if (containerView instanceof Diagram) {
- containerVisualID = DeploymentDiagramEditPart.VISUAL_ID;
- } else {
- return -1;
- }
- }
- switch (containerVisualID) {
- case DeploymentDiagramEditPart.VISUAL_ID:
- if (UMLPackage.eINSTANCE.getDependency().isSuperTypeOf(domainElement.eClass())) {
- return DependencyNodeEditPart.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getModel().isSuperTypeOf(domainElement.eClass())) {
- return ModelEditPart.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) {
- return PackageEditPart.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) {
- return ConstraintEditPart.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) {
- return CommentEditPart.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) {
- return ExecutionEnvironmentEditPart.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) {
- return DeviceEditPart.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) {
- return ArtifactEditPart.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) {
- return NodeEditPart.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getNamedElement().isSuperTypeOf(domainElement.eClass())) {
- return DefaultNamedElementEditPart.VISUAL_ID;
- }
- break;
- case ModelPackageableElementCompartmentEditPart.VISUAL_ID:
- if (UMLPackage.eINSTANCE.getModel().isSuperTypeOf(domainElement.eClass())) {
- return ModelEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) {
- return PackageEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) {
- return NestedDeviceEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) {
- return NestedExecutionEnvironmentEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) {
- return NestedNodeEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) {
- return NestedArtifactNodeEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) {
- return CommentEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) {
- return ConstraintEditPartCN.VISUAL_ID;
- }
- break;
- case PackagePackageableElementCompartmentEditPart.VISUAL_ID:
- if (UMLPackage.eINSTANCE.getModel().isSuperTypeOf(domainElement.eClass())) {
- return ModelEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) {
- return PackageEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) {
- return NestedArtifactNodeEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) {
- return NestedDeviceEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) {
- return NestedExecutionEnvironmentEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) {
- return NestedNodeEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) {
- return CommentEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) {
- return ConstraintEditPartCN.VISUAL_ID;
- }
- break;
- case DeviceCompositeCompartmentEditPart.VISUAL_ID:
- if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) {
- return ExecutionEnvironmentEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) {
- return DeviceEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) {
- return NodeEditPartCN.VISUAL_ID;
- }
- break;
- case ExecutionEnvironmentCompositeCompartmentEditPart.VISUAL_ID:
- if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) {
- return ExecutionEnvironmentEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) {
- return ArtifactEditPartCN.VISUAL_ID;
- }
- break;
- case NodeCompositeCompartmentEditPart.VISUAL_ID:
- if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) {
- return DeviceEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) {
- return ExecutionEnvironmentEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) {
- return ArtifactEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) {
- return NodeEditPartCN.VISUAL_ID;
- }
- break;
- case ArtifactCompositeCompartmentEditPart.VISUAL_ID:
- if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) {
- return ArtifactEditPartACN.VISUAL_ID;
- }
- break;
- case ModelPackageableElementCompartmentEditPartCN.VISUAL_ID:
- if (UMLPackage.eINSTANCE.getModel().isSuperTypeOf(domainElement.eClass())) {
- return ModelEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) {
- return PackageEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) {
- return NestedDeviceEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) {
- return NestedExecutionEnvironmentEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) {
- return NestedNodeEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) {
- return NestedArtifactNodeEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) {
- return CommentEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) {
- return ConstraintEditPartCN.VISUAL_ID;
- }
- break;
- case PackagePackageableElementCompartmentEditPartCN.VISUAL_ID:
- if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) {
- return PackageEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) {
- return NestedArtifactNodeEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) {
- return NestedDeviceEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) {
- return NestedExecutionEnvironmentEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) {
- return NestedNodeEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) {
- return CommentEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) {
- return ConstraintEditPartCN.VISUAL_ID;
- }
- break;
- case DeviceCompositeCompartmentEditPartCN.VISUAL_ID:
- if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) {
- return ExecutionEnvironmentEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) {
- return DeviceEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) {
- return NodeEditPartCN.VISUAL_ID;
- }
- break;
- case ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID:
- if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) {
- return ArtifactEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) {
- return ExecutionEnvironmentEditPartCN.VISUAL_ID;
- }
- break;
- case NodeCompositeCompartmentEditPartCN.VISUAL_ID:
- if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) {
- return DeviceEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) {
- return ExecutionEnvironmentEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) {
- return NodeEditPartCN.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) {
- return ArtifactEditPartCN.VISUAL_ID;
- }
- break;
- case ArtifactCompositeCompartmentEditPartCN.VISUAL_ID:
- if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) {
- return ArtifactEditPartACN.VISUAL_ID;
- }
- break;
- case ArtifactCompositeCompartmentEditPartACN.VISUAL_ID:
- if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) {
- return ArtifactEditPartACN.VISUAL_ID;
- }
- break;
- }
- return -1;
- }
-
- /**
- * @generated
- */
- public static boolean canCreateNode(View containerView, int nodeVisualID) {
- String containerModelID = org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getModelID(containerView);
- if (!DeploymentDiagramEditPart.MODEL_ID.equals(containerModelID)) {
- return false;
- }
- int containerVisualID;
- if (DeploymentDiagramEditPart.MODEL_ID.equals(containerModelID)) {
- containerVisualID = org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getVisualID(containerView);
- } else {
- if (containerView instanceof Diagram) {
- containerVisualID = DeploymentDiagramEditPart.VISUAL_ID;
- } else {
- return false;
- }
- }
- switch (containerVisualID) {
- case DeploymentDiagramEditPart.VISUAL_ID:
- if (DependencyNodeEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ModelEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (PackageEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ConstraintEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (CommentEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ExecutionEnvironmentEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (DeviceEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ArtifactEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (NodeEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (DefaultNamedElementEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case DependencyNodeEditPart.VISUAL_ID:
- if (MultiDependencyLabelEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case ModelEditPart.VISUAL_ID:
- if (ModelNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ModelPackageableElementCompartmentEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case PackageEditPart.VISUAL_ID:
- if (PackageNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (PackagePackageableElementCompartmentEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case ConstraintEditPart.VISUAL_ID:
- if (ConstraintNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ConstraintSpecificationEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case CommentEditPart.VISUAL_ID:
- if (CommentBodyEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case ExecutionEnvironmentEditPart.VISUAL_ID:
- if (ExecutionEnvironmentNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ExecutionEnvironmentCompositeCompartmentEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case DeviceEditPart.VISUAL_ID:
- if (DeviceNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (DeviceCompositeCompartmentEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case ArtifactEditPart.VISUAL_ID:
- if (ArtifactNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ArtifactFloatingLabelEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ArtifactCompositeCompartmentEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case NodeEditPart.VISUAL_ID:
- if (NodeNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (NodeCompositeCompartmentEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case DefaultNamedElementEditPart.VISUAL_ID:
- if (DefaultNamedElementNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case ModelEditPartCN.VISUAL_ID:
- if (ModelNameEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ModelPackageableElementCompartmentEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case PackageEditPartCN.VISUAL_ID:
- if (PackageNameEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (PackagePackageableElementCompartmentEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case DeviceEditPartCN.VISUAL_ID:
- if (DeviceNameEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case NestedDeviceEditPartCN.VISUAL_ID:
- if (NestedDeviceNameEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (DeviceCompositeCompartmentEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case ExecutionEnvironmentEditPartCN.VISUAL_ID:
- if (ExecutionEnvironmentNameEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case NestedExecutionEnvironmentEditPartCN.VISUAL_ID:
- if (NestedExecutionEnvironmentNameEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case NodeEditPartCN.VISUAL_ID:
- if (NodeNameEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case NestedNodeEditPartCN.VISUAL_ID:
- if (NestedNodeNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (NodeCompositeCompartmentEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case ArtifactEditPartCN.VISUAL_ID:
- if (ArtifactNameEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ArtifactFloatingLabelEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ArtifactCompositeCompartmentEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case ArtifactEditPartACN.VISUAL_ID:
- if (ArtifactNameEditPartACN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ArtifactFloatingLabelEditPartACN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ArtifactCompositeCompartmentEditPartACN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case NestedArtifactNodeEditPartCN.VISUAL_ID:
- if (NestedArtifactNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case CommentEditPartCN.VISUAL_ID:
- if (CommentBodyEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case ConstraintEditPartCN.VISUAL_ID:
- if (ConstraintNameEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ConstraintSpecificationEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case ModelPackageableElementCompartmentEditPart.VISUAL_ID:
- if (ModelEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (PackageEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (NestedDeviceEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (NestedExecutionEnvironmentEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (NestedNodeEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (NestedArtifactNodeEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (CommentEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ConstraintEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case PackagePackageableElementCompartmentEditPart.VISUAL_ID:
- if (ModelEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (PackageEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (NestedArtifactNodeEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (NestedDeviceEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (NestedExecutionEnvironmentEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (NestedNodeEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (CommentEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ConstraintEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case DeviceCompositeCompartmentEditPart.VISUAL_ID:
- if (ExecutionEnvironmentEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (DeviceEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (NodeEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case ExecutionEnvironmentCompositeCompartmentEditPart.VISUAL_ID:
- if (ExecutionEnvironmentEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ArtifactEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case NodeCompositeCompartmentEditPart.VISUAL_ID:
- if (DeviceEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ExecutionEnvironmentEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ArtifactEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (NodeEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case ArtifactCompositeCompartmentEditPart.VISUAL_ID:
- if (ArtifactEditPartACN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case ModelPackageableElementCompartmentEditPartCN.VISUAL_ID:
- if (ModelEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (PackageEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (NestedDeviceEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (NestedExecutionEnvironmentEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (NestedNodeEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (NestedArtifactNodeEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (CommentEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ConstraintEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case PackagePackageableElementCompartmentEditPartCN.VISUAL_ID:
- if (PackageEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (NestedArtifactNodeEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (NestedDeviceEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (NestedExecutionEnvironmentEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (NestedNodeEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (CommentEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ConstraintEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case DeviceCompositeCompartmentEditPartCN.VISUAL_ID:
- if (ExecutionEnvironmentEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (DeviceEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (NodeEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID:
- if (ArtifactEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ExecutionEnvironmentEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case NodeCompositeCompartmentEditPartCN.VISUAL_ID:
- if (DeviceEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ExecutionEnvironmentEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (NodeEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ArtifactEditPartCN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case ArtifactCompositeCompartmentEditPartCN.VISUAL_ID:
- if (ArtifactEditPartACN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case ArtifactCompositeCompartmentEditPartACN.VISUAL_ID:
- if (ArtifactEditPartACN.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case DeploymentEditPart.VISUAL_ID:
- if (DeploymentNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (DeploymentAppliedStereotypeEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case ManifestationEditPart.VISUAL_ID:
- if (ManifestationNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (ManifestationAppliedStereotypeEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case GeneralizationEditPart.VISUAL_ID:
- if (GeneralizationAppliedStereotypeEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- case DependencyEditPart.VISUAL_ID:
- if (DependencyNameEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- if (DependencyAppliedStereotypeEditPart.VISUAL_ID == nodeVisualID) {
- return true;
- }
- break;
- }
- return false;
- }
-
- /**
- * @generated
- */
- public static int getLinkWithClassVisualID(EObject domainElement) {
- if (domainElement == null) {
- return -1;
- }
- if (UMLPackage.eINSTANCE.getDeployment().isSuperTypeOf(domainElement.eClass())) {
- return DeploymentEditPart.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getManifestation().isSuperTypeOf(domainElement.eClass())) {
- return ManifestationEditPart.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getGeneralization().isSuperTypeOf(domainElement.eClass())) {
- return GeneralizationEditPart.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getDependency().isSuperTypeOf(domainElement.eClass())) {
- return DependencyEditPart.VISUAL_ID;
- }
- if (UMLPackage.eINSTANCE.getDependency().isSuperTypeOf(domainElement.eClass())) {
- return DependencyBranchEditPart.VISUAL_ID;
- }
- return -1;
- }
-
- /**
- * User can change implementation of this method to handle some specific
- * situations not covered by default logic.
- *
- * @generated
- */
- private static boolean isDiagram(Package element) {
- return true;
- }
-
- /**
- * @generated
- */
- public static boolean checkNodeVisualID(View containerView, EObject domainElement, int candidate) {
- if (candidate == -1) {
- // unrecognized id is always bad
- return false;
- }
- int basic = getNodeVisualID(containerView, domainElement);
- return basic == candidate;
- }
-
- /**
- * @generated
- */
- public static boolean isCompartmentVisualID(int visualID) {
- switch (visualID) {
- case ModelPackageableElementCompartmentEditPart.VISUAL_ID:
- case PackagePackageableElementCompartmentEditPart.VISUAL_ID:
- case DeviceCompositeCompartmentEditPart.VISUAL_ID:
- case ExecutionEnvironmentCompositeCompartmentEditPart.VISUAL_ID:
- case NodeCompositeCompartmentEditPart.VISUAL_ID:
- case ArtifactCompositeCompartmentEditPart.VISUAL_ID:
- case ModelPackageableElementCompartmentEditPartCN.VISUAL_ID:
- case PackagePackageableElementCompartmentEditPartCN.VISUAL_ID:
- case DeviceCompositeCompartmentEditPartCN.VISUAL_ID:
- case ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID:
- case NodeCompositeCompartmentEditPartCN.VISUAL_ID:
- case ArtifactCompositeCompartmentEditPartCN.VISUAL_ID:
- case ArtifactCompositeCompartmentEditPartACN.VISUAL_ID:
- return true;
- default:
- break;
- }
- return false;
- }
-
- /**
- * @generated
- */
- public static boolean isSemanticLeafVisualID(int visualID) {
- switch (visualID) {
- case DeploymentDiagramEditPart.VISUAL_ID:
- return false;
- case DeviceEditPartCN.VISUAL_ID:
- case ExecutionEnvironmentEditPartCN.VISUAL_ID:
- case NodeEditPartCN.VISUAL_ID:
- case NestedArtifactNodeEditPartCN.VISUAL_ID:
- case CommentEditPartCN.VISUAL_ID:
- case ConstraintEditPartCN.VISUAL_ID:
- case CommentEditPart.VISUAL_ID:
- case ConstraintEditPart.VISUAL_ID:
- case DependencyNodeEditPart.VISUAL_ID:
- case DefaultNamedElementEditPart.VISUAL_ID:
- return true;
- default:
- break;
- }
- return false;
- }
-
- /**
- * @generated
- */
- public static final DiagramStructure TYPED_INSTANCE = new DiagramStructure() {
- /**
- * @generated
- */
- @Override
- public int getVisualID(View view) {
- return org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getVisualID(view);
- }
-
- /**
- * @generated
- */
- @Override
- public String getModelID(View view) {
- return org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getModelID(view);
- }
-
- /**
- * @generated
- */
- @Override
- public int getNodeVisualID(View containerView, EObject domainElement) {
- return org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getNodeVisualID(containerView, domainElement);
- }
-
- /**
- * @generated
- */
- @Override
- public boolean checkNodeVisualID(View containerView, EObject domainElement, int candidate) {
- return org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.checkNodeVisualID(containerView, domainElement, candidate);
- }
-
- /**
- * @generated
- */
- @Override
- public boolean isCompartmentVisualID(int visualID) {
- return org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.isCompartmentVisualID(visualID);
- }
-
- /**
- * @generated
- */
- @Override
- public boolean isSemanticLeafVisualID(int visualID) {
- return org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.isSemanticLeafVisualID(visualID);
- }
- };
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.part;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.structure.DiagramStructure;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactCompositeCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactCompositeCompartmentEditPartACN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactCompositeCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPartACN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartACN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPartACN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentBodyEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentBodyEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintSpecificationEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintSpecificationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DefaultNamedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DefaultNamedElementNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNodeEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceCompositeCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceCompositeCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentCompositeCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentCompositeCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelPackageableElementCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelPackageableElementCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.MultiDependencyLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedArtifactNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedArtifactNodeEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedDeviceEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedDeviceNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedExecutionEnvironmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedExecutionEnvironmentNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedNodeEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedNodeNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeCompositeCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeCompositeCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackagePackageableElementCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackagePackageableElementCompartmentEditPartCN;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * This registry is used to determine which type of visual object should be
+ * created for the corresponding Diagram, Node, ChildNode or Link represented
+ * by a domain model object.
+ *
+ * @generated
+ */
+public class UMLVisualIDRegistry {
+
+ /**
+ * @generated
+ */
+ private static final String DEBUG_KEY = "org.eclipse.papyrus.uml.diagram.deployment/debug/visualID"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static int getVisualID(View view) {
+ if (view instanceof Diagram) {
+ if (DeploymentDiagramEditPart.MODEL_ID.equals(view.getType())) {
+ return DeploymentDiagramEditPart.VISUAL_ID;
+ } else {
+ return -1;
+ }
+ }
+ return org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getVisualID(view.getType());
+ }
+
+ /**
+ * @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 annotation.getDetails().get("modelID"); //$NON-NLS-1$
+ }
+ view = (View) view.eContainer();
+ }
+ return diagram != null ? diagram.getType() : null;
+ }
+
+ /**
+ * @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 String getType(int visualID) {
+ return Integer.toString(visualID);
+ }
+
+ /**
+ * @generated
+ */
+ public static int getDiagramVisualID(EObject domainElement) {
+ if (domainElement == null) {
+ return -1;
+ }
+ return 1000;
+ }
+
+ /**
+ * @generated
+ */
+ public static int getNodeVisualID(View containerView, EObject domainElement) {
+ if (domainElement == null) {
+ return -1;
+ }
+ String containerModelID = org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getModelID(containerView);
+ if (!DeploymentDiagramEditPart.MODEL_ID.equals(containerModelID)) {
+ return -1;
+ }
+ int containerVisualID;
+ if (DeploymentDiagramEditPart.MODEL_ID.equals(containerModelID)) {
+ containerVisualID = org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getVisualID(containerView);
+ } else {
+ if (containerView instanceof Diagram) {
+ containerVisualID = DeploymentDiagramEditPart.VISUAL_ID;
+ } else {
+ return -1;
+ }
+ }
+ switch (containerVisualID) {
+ case DeploymentDiagramEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getDependency().isSuperTypeOf(domainElement.eClass())) {
+ return DependencyNodeEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getModel().isSuperTypeOf(domainElement.eClass())) {
+ return ModelEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) {
+ return PackageEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) {
+ return ConstraintEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) {
+ return CommentEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) {
+ return ExecutionEnvironmentEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) {
+ return DeviceEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) {
+ return ArtifactEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) {
+ return NodeEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getNamedElement().isSuperTypeOf(domainElement.eClass())) {
+ return DefaultNamedElementEditPart.VISUAL_ID;
+ }
+ break;
+ case ModelPackageableElementCompartmentEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getModel().isSuperTypeOf(domainElement.eClass())) {
+ return ModelEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) {
+ return PackageEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) {
+ return NestedDeviceEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) {
+ return NestedExecutionEnvironmentEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) {
+ return NestedNodeEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) {
+ return NestedArtifactNodeEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) {
+ return CommentEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) {
+ return ConstraintEditPartCN.VISUAL_ID;
+ }
+ break;
+ case PackagePackageableElementCompartmentEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getModel().isSuperTypeOf(domainElement.eClass())) {
+ return ModelEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) {
+ return PackageEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) {
+ return NestedArtifactNodeEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) {
+ return NestedDeviceEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) {
+ return NestedExecutionEnvironmentEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) {
+ return NestedNodeEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) {
+ return CommentEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) {
+ return ConstraintEditPartCN.VISUAL_ID;
+ }
+ break;
+ case DeviceCompositeCompartmentEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) {
+ return ExecutionEnvironmentEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) {
+ return DeviceEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) {
+ return NodeEditPartCN.VISUAL_ID;
+ }
+ break;
+ case ExecutionEnvironmentCompositeCompartmentEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) {
+ return ExecutionEnvironmentEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) {
+ return ArtifactEditPartCN.VISUAL_ID;
+ }
+ break;
+ case NodeCompositeCompartmentEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) {
+ return DeviceEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) {
+ return ExecutionEnvironmentEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) {
+ return ArtifactEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) {
+ return NodeEditPartCN.VISUAL_ID;
+ }
+ break;
+ case ArtifactCompositeCompartmentEditPart.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) {
+ return ArtifactEditPartACN.VISUAL_ID;
+ }
+ break;
+ case ModelPackageableElementCompartmentEditPartCN.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getModel().isSuperTypeOf(domainElement.eClass())) {
+ return ModelEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) {
+ return PackageEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) {
+ return NestedDeviceEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) {
+ return NestedExecutionEnvironmentEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) {
+ return NestedNodeEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) {
+ return NestedArtifactNodeEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) {
+ return CommentEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) {
+ return ConstraintEditPartCN.VISUAL_ID;
+ }
+ break;
+ case PackagePackageableElementCompartmentEditPartCN.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) {
+ return PackageEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) {
+ return NestedArtifactNodeEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) {
+ return NestedDeviceEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) {
+ return NestedExecutionEnvironmentEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) {
+ return NestedNodeEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) {
+ return CommentEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) {
+ return ConstraintEditPartCN.VISUAL_ID;
+ }
+ break;
+ case DeviceCompositeCompartmentEditPartCN.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) {
+ return ExecutionEnvironmentEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) {
+ return DeviceEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) {
+ return NodeEditPartCN.VISUAL_ID;
+ }
+ break;
+ case ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) {
+ return ArtifactEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) {
+ return ExecutionEnvironmentEditPartCN.VISUAL_ID;
+ }
+ break;
+ case NodeCompositeCompartmentEditPartCN.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) {
+ return DeviceEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) {
+ return ExecutionEnvironmentEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) {
+ return NodeEditPartCN.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) {
+ return ArtifactEditPartCN.VISUAL_ID;
+ }
+ break;
+ case ArtifactCompositeCompartmentEditPartCN.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) {
+ return ArtifactEditPartACN.VISUAL_ID;
+ }
+ break;
+ case ArtifactCompositeCompartmentEditPartACN.VISUAL_ID:
+ if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) {
+ return ArtifactEditPartACN.VISUAL_ID;
+ }
+ break;
+ }
+ return -1;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canCreateNode(View containerView, int nodeVisualID) {
+ String containerModelID = org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getModelID(containerView);
+ if (!DeploymentDiagramEditPart.MODEL_ID.equals(containerModelID)) {
+ return false;
+ }
+ int containerVisualID;
+ if (DeploymentDiagramEditPart.MODEL_ID.equals(containerModelID)) {
+ containerVisualID = org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getVisualID(containerView);
+ } else {
+ if (containerView instanceof Diagram) {
+ containerVisualID = DeploymentDiagramEditPart.VISUAL_ID;
+ } else {
+ return false;
+ }
+ }
+ switch (containerVisualID) {
+ case DeploymentDiagramEditPart.VISUAL_ID:
+ if (DependencyNodeEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ModelEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (PackageEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ConstraintEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (CommentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ExecutionEnvironmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DeviceEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ArtifactEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (NodeEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DefaultNamedElementEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case DependencyNodeEditPart.VISUAL_ID:
+ if (MultiDependencyLabelEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ModelEditPart.VISUAL_ID:
+ if (ModelNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ModelPackageableElementCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case PackageEditPart.VISUAL_ID:
+ if (PackageNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (PackagePackageableElementCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ConstraintEditPart.VISUAL_ID:
+ if (ConstraintNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ConstraintSpecificationEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case CommentEditPart.VISUAL_ID:
+ if (CommentBodyEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ExecutionEnvironmentEditPart.VISUAL_ID:
+ if (ExecutionEnvironmentNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ExecutionEnvironmentCompositeCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case DeviceEditPart.VISUAL_ID:
+ if (DeviceNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DeviceCompositeCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ArtifactEditPart.VISUAL_ID:
+ if (ArtifactNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ArtifactFloatingLabelEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ArtifactCompositeCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case NodeEditPart.VISUAL_ID:
+ if (NodeNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (NodeCompositeCompartmentEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case DefaultNamedElementEditPart.VISUAL_ID:
+ if (DefaultNamedElementNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ModelEditPartCN.VISUAL_ID:
+ if (ModelNameEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ModelPackageableElementCompartmentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case PackageEditPartCN.VISUAL_ID:
+ if (PackageNameEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (PackagePackageableElementCompartmentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case DeviceEditPartCN.VISUAL_ID:
+ if (DeviceNameEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case NestedDeviceEditPartCN.VISUAL_ID:
+ if (NestedDeviceNameEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DeviceCompositeCompartmentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ExecutionEnvironmentEditPartCN.VISUAL_ID:
+ if (ExecutionEnvironmentNameEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case NestedExecutionEnvironmentEditPartCN.VISUAL_ID:
+ if (NestedExecutionEnvironmentNameEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case NodeEditPartCN.VISUAL_ID:
+ if (NodeNameEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case NestedNodeEditPartCN.VISUAL_ID:
+ if (NestedNodeNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (NodeCompositeCompartmentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ArtifactEditPartCN.VISUAL_ID:
+ if (ArtifactNameEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ArtifactFloatingLabelEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ArtifactCompositeCompartmentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ArtifactEditPartACN.VISUAL_ID:
+ if (ArtifactNameEditPartACN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ArtifactFloatingLabelEditPartACN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ArtifactCompositeCompartmentEditPartACN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case NestedArtifactNodeEditPartCN.VISUAL_ID:
+ if (NestedArtifactNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case CommentEditPartCN.VISUAL_ID:
+ if (CommentBodyEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ConstraintEditPartCN.VISUAL_ID:
+ if (ConstraintNameEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ConstraintSpecificationEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ModelPackageableElementCompartmentEditPart.VISUAL_ID:
+ if (ModelEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (PackageEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (NestedDeviceEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (NestedExecutionEnvironmentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (NestedNodeEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (NestedArtifactNodeEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (CommentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ConstraintEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case PackagePackageableElementCompartmentEditPart.VISUAL_ID:
+ if (ModelEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (PackageEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (NestedArtifactNodeEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (NestedDeviceEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (NestedExecutionEnvironmentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (NestedNodeEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (CommentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ConstraintEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case DeviceCompositeCompartmentEditPart.VISUAL_ID:
+ if (ExecutionEnvironmentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DeviceEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (NodeEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ExecutionEnvironmentCompositeCompartmentEditPart.VISUAL_ID:
+ if (ExecutionEnvironmentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ArtifactEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case NodeCompositeCompartmentEditPart.VISUAL_ID:
+ if (DeviceEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ExecutionEnvironmentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ArtifactEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (NodeEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ArtifactCompositeCompartmentEditPart.VISUAL_ID:
+ if (ArtifactEditPartACN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ModelPackageableElementCompartmentEditPartCN.VISUAL_ID:
+ if (ModelEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (PackageEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (NestedDeviceEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (NestedExecutionEnvironmentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (NestedNodeEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (NestedArtifactNodeEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (CommentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ConstraintEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case PackagePackageableElementCompartmentEditPartCN.VISUAL_ID:
+ if (PackageEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (NestedArtifactNodeEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (NestedDeviceEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (NestedExecutionEnvironmentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (NestedNodeEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (CommentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ConstraintEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case DeviceCompositeCompartmentEditPartCN.VISUAL_ID:
+ if (ExecutionEnvironmentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DeviceEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (NodeEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID:
+ if (ArtifactEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ExecutionEnvironmentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case NodeCompositeCompartmentEditPartCN.VISUAL_ID:
+ if (DeviceEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ExecutionEnvironmentEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (NodeEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ArtifactEditPartCN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ArtifactCompositeCompartmentEditPartCN.VISUAL_ID:
+ if (ArtifactEditPartACN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ArtifactCompositeCompartmentEditPartACN.VISUAL_ID:
+ if (ArtifactEditPartACN.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case DeploymentEditPart.VISUAL_ID:
+ if (DeploymentNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DeploymentAppliedStereotypeEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case ManifestationEditPart.VISUAL_ID:
+ if (ManifestationNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (ManifestationAppliedStereotypeEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case GeneralizationEditPart.VISUAL_ID:
+ if (GeneralizationAppliedStereotypeEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case DependencyEditPart.VISUAL_ID:
+ if (DependencyNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (DependencyAppliedStereotypeEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public static int getLinkWithClassVisualID(EObject domainElement) {
+ if (domainElement == null) {
+ return -1;
+ }
+ if (UMLPackage.eINSTANCE.getDeployment().isSuperTypeOf(domainElement.eClass())) {
+ return DeploymentEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getManifestation().isSuperTypeOf(domainElement.eClass())) {
+ return ManifestationEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getGeneralization().isSuperTypeOf(domainElement.eClass())) {
+ return GeneralizationEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getDependency().isSuperTypeOf(domainElement.eClass())) {
+ return DependencyEditPart.VISUAL_ID;
+ }
+ if (UMLPackage.eINSTANCE.getDependency().isSuperTypeOf(domainElement.eClass())) {
+ return DependencyBranchEditPart.VISUAL_ID;
+ }
+ return -1;
+ }
+
+ /**
+ * User can change implementation of this method to handle some specific
+ * situations not covered by default logic.
+ *
+ * @generated
+ */
+ private static boolean isDiagram(Package element) {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean checkNodeVisualID(View containerView, EObject domainElement, int candidate) {
+ if (candidate == -1) {
+ //unrecognized id is always bad
+ return false;
+ }
+ int basic = getNodeVisualID(containerView, domainElement);
+ return basic == candidate;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean isCompartmentVisualID(int visualID) {
+ switch (visualID) {
+ case ModelPackageableElementCompartmentEditPart.VISUAL_ID:
+ case PackagePackageableElementCompartmentEditPart.VISUAL_ID:
+ case DeviceCompositeCompartmentEditPart.VISUAL_ID:
+ case ExecutionEnvironmentCompositeCompartmentEditPart.VISUAL_ID:
+ case NodeCompositeCompartmentEditPart.VISUAL_ID:
+ case ArtifactCompositeCompartmentEditPart.VISUAL_ID:
+ case ModelPackageableElementCompartmentEditPartCN.VISUAL_ID:
+ case PackagePackageableElementCompartmentEditPartCN.VISUAL_ID:
+ case DeviceCompositeCompartmentEditPartCN.VISUAL_ID:
+ case ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID:
+ case NodeCompositeCompartmentEditPartCN.VISUAL_ID:
+ case ArtifactCompositeCompartmentEditPartCN.VISUAL_ID:
+ case ArtifactCompositeCompartmentEditPartACN.VISUAL_ID:
+ return true;
+ default:
+ break;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean isSemanticLeafVisualID(int visualID) {
+ switch (visualID) {
+ case DeploymentDiagramEditPart.VISUAL_ID:
+ return false;
+ case DeviceEditPartCN.VISUAL_ID:
+ case ExecutionEnvironmentEditPartCN.VISUAL_ID:
+ case NodeEditPartCN.VISUAL_ID:
+ case NestedArtifactNodeEditPartCN.VISUAL_ID:
+ case CommentEditPartCN.VISUAL_ID:
+ case ConstraintEditPartCN.VISUAL_ID:
+ case CommentEditPart.VISUAL_ID:
+ case ConstraintEditPart.VISUAL_ID:
+ case DependencyNodeEditPart.VISUAL_ID:
+ case DefaultNamedElementEditPart.VISUAL_ID:
+ return true;
+ default:
+ break;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public static final DiagramStructure TYPED_INSTANCE = new DiagramStructure() {
+ /**
+ * @generated
+ */
+ @Override
+ public int getVisualID(View view) {
+ return org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getVisualID(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getModelID(View view) {
+ return org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getModelID(view);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public int getNodeVisualID(View containerView, EObject domainElement) {
+ return org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getNodeVisualID(containerView, domainElement);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean checkNodeVisualID(View containerView, EObject domainElement, int candidate) {
+ return org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.checkNodeVisualID(containerView, domainElement, candidate);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean isCompartmentVisualID(int visualID) {
+ return org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.isCompartmentVisualID(visualID);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean isSemanticLeafVisualID(int visualID) {
+ return org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.isSemanticLeafVisualID(visualID);
+ }
+ };
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/ValidateAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/ValidateAction.java
index 2a21e3857bd..5480fdf283f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/ValidateAction.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/ValidateAction.java
@@ -1,302 +1,292 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.part;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.Diagnostician;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.emf.validation.model.EvaluationMode;
-import org.eclipse.emf.validation.model.IConstraintStatus;
-import org.eclipse.emf.validation.service.IBatchValidator;
-import org.eclipse.emf.validation.service.ModelValidationService;
-import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gmf.runtime.diagram.ui.OffscreenEditPartFactory;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart;
-import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLMarkerNavigationProvider;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLValidationProvider;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-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 IWorkbenchPage page;
-
- /**
- * @generated
- */
- public ValidateAction(IWorkbenchPage page) {
- setText(Messages.ValidateActionMessage);
- this.page = page;
- }
-
- /**
- * @generated
- */
- @Override
- public void run() {
- IWorkbenchPart workbenchPart = page.getActivePart();
- if (workbenchPart instanceof IDiagramWorkbenchPart) {
- final IDiagramWorkbenchPart part = (IDiagramWorkbenchPart) workbenchPart;
- try {
- new WorkspaceModifyDelegatingOperation(
- new IRunnableWithProgress() {
-
- @Override
- 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$
- }
- }
- }
-
- /**
- * @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
- */
- public static void runNonUIValidation(View view) {
- Shell shell = Display.getCurrent().getActiveShell();
- if (shell == null) {
- shell = new Shell();
- }
-
- DiagramEditPart diagramEditPart =
- OffscreenEditPartFactory.getInstance().createDiagramEditPart(
- view.getDiagram(), shell);
- 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() {
-
- @Override
- public void run() {
- validate(fpart, fview);
- }
- });
- }
-
- /**
- * @generated
- */
- private static Diagnostic runEMFValidator(View target) {
- if (target.isSetElement() && target.getElement() != null) {
- return new Diagnostician() {
-
- @Override
- public String getObjectLabel(EObject eObject) {
- return EMFCoreUtil.getQualifiedName(eObject, true);
- }
- }.validate(target.getElement());
- }
- return Diagnostic.OK_INSTANCE;
- }
-
- /**
- * @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 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 void createMarkers(IFile
- target, Diagnostic emfValidationStatus, DiagramEditPart diagramEditPart) {
- if (emfValidationStatus.getSeverity() == Diagnostic.OK) {
- return;
- }
- final Diagnostic rootStatus = emfValidationStatus;
- List<Diagnostic> allDiagnostics = new ArrayList<Diagnostic>();
- UMLDiagramEditorUtil.LazyElement2ViewMap element2ViewMap =
- new UMLDiagramEditorUtil.LazyElement2ViewMap(
- diagramEditPart.getDiagramView(),
- collectTargetElements(rootStatus, new HashSet<EObject>(), allDiagnostics));
- for (Iterator<Diagnostic> it = emfValidationStatus.getChildren().iterator(); it.hasNext();) {
- Diagnostic nextDiagnostic = 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 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 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 Set<EObject> collectTargetElements(IStatus status, Set<EObject> targetElementCollector, List<IConstraintStatus> allConstraintStatuses) {
- if (status instanceof IConstraintStatus) {
- targetElementCollector.add(((IConstraintStatus) status).getTarget());
- allConstraintStatuses.add((IConstraintStatus) 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 Set<EObject> collectTargetElements(Diagnostic diagnostic, Set<EObject> targetElementCollector, List<Diagnostic> 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<Diagnostic> it = diagnostic.getChildren().iterator(); it.hasNext();) {
- collectTargetElements(it.next(),
- targetElementCollector, allDiagnostics);
- }
- }
- return targetElementCollector;
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.part;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.Diagnostician;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.emf.validation.model.EvaluationMode;
+import org.eclipse.emf.validation.model.IConstraintStatus;
+import org.eclipse.emf.validation.service.IBatchValidator;
+import org.eclipse.emf.validation.service.ModelValidationService;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gmf.runtime.diagram.ui.OffscreenEditPartFactory;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart;
+import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLMarkerNavigationProvider;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLValidationProvider;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+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 IWorkbenchPage page;
+
+ /**
+ * @generated
+ */
+ public ValidateAction(IWorkbenchPage page) {
+ setText(Messages.ValidateActionMessage);
+ this.page = page;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public void run() {
+ IWorkbenchPart workbenchPart = page.getActivePart();
+ if (workbenchPart instanceof IDiagramWorkbenchPart) {
+ final IDiagramWorkbenchPart part = (IDiagramWorkbenchPart) workbenchPart;
+ try {
+ new WorkspaceModifyDelegatingOperation(
+ new IRunnableWithProgress() {
+
+ @Override
+ 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$
+ }
+ }
+ }
+
+ /**
+ * @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
+ */
+ public static void runNonUIValidation(View view) {
+ Shell shell = Display.getCurrent().getActiveShell();
+ if (shell == null) {
+ shell = new Shell();
+ }
+
+ DiagramEditPart diagramEditPart = OffscreenEditPartFactory.getInstance().createDiagramEditPart(
+ view.getDiagram(), shell);
+ 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() {
+
+ @Override
+ public void run() {
+ validate(fpart, fview);
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ private static Diagnostic runEMFValidator(View target) {
+ if (target.isSetElement() && target.getElement() != null) {
+ return new Diagnostician() {
+
+ @Override
+ public String getObjectLabel(EObject eObject) {
+ return EMFCoreUtil.getQualifiedName(eObject, true);
+ }
+ }.validate(target.getElement());
+ }
+ return Diagnostic.OK_INSTANCE;
+ }
+
+ /**
+ * @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 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 void createMarkers(IFile target, Diagnostic emfValidationStatus, DiagramEditPart diagramEditPart) {
+ if (emfValidationStatus.getSeverity() == Diagnostic.OK) {
+ return;
+ }
+ final Diagnostic rootStatus = emfValidationStatus;
+ List<Diagnostic> allDiagnostics = new ArrayList<Diagnostic>();
+ UMLDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new UMLDiagramEditorUtil.LazyElement2ViewMap(
+ diagramEditPart.getDiagramView(),
+ collectTargetElements(rootStatus, new HashSet<EObject>(), allDiagnostics));
+ for (Iterator<Diagnostic> it = emfValidationStatus.getChildren().iterator(); it.hasNext();) {
+ Diagnostic nextDiagnostic = 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 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 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 Set<EObject> collectTargetElements(IStatus status, Set<EObject> targetElementCollector, List<IConstraintStatus> allConstraintStatuses) {
+ if (status instanceof IConstraintStatus) {
+ targetElementCollector.add(((IConstraintStatus) status).getTarget());
+ allConstraintStatuses.add((IConstraintStatus) 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 Set<EObject> collectTargetElements(Diagnostic diagnostic, Set<EObject> targetElementCollector, List<Diagnostic> 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<Diagnostic> it = diagnostic.getChildren().iterator(); it.hasNext();) {
+ collectTargetElements(it.next(), targetElementCollector, allDiagnostics);
+ }
+ }
+ return targetElementCollector;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramAppearancePreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramAppearancePreferencePage.java
index d3b82cebbd0..f79bd13531d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramAppearancePreferencePage.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramAppearancePreferencePage.java
@@ -1,28 +1,28 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.preferences;
-
-import org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePreferencePage;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class DiagramAppearancePreferencePage extends AppearancePreferencePage {
-
- /**
- * @generated
- */
- public DiagramAppearancePreferencePage() {
- setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.preferences;
+
+import org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePreferencePage;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+public class DiagramAppearancePreferencePage extends AppearancePreferencePage {
+
+ /**
+ * @generated
+ */
+ public DiagramAppearancePreferencePage() {
+ setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramConnectionsPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramConnectionsPreferencePage.java
index b679bd23a6f..da68a3fc9f9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramConnectionsPreferencePage.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramConnectionsPreferencePage.java
@@ -1,28 +1,28 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.preferences;
-
-import org.eclipse.gmf.runtime.diagram.ui.preferences.ConnectionsPreferencePage;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class DiagramConnectionsPreferencePage extends ConnectionsPreferencePage {
-
- /**
- * @generated
- */
- public DiagramConnectionsPreferencePage() {
- setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.preferences;
+
+import org.eclipse.gmf.runtime.diagram.ui.preferences.ConnectionsPreferencePage;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+public class DiagramConnectionsPreferencePage extends ConnectionsPreferencePage {
+
+ /**
+ * @generated
+ */
+ public DiagramConnectionsPreferencePage() {
+ setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramGeneralPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramGeneralPreferencePage.java
index 81dfb2a5727..8da82d2ab37 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramGeneralPreferencePage.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramGeneralPreferencePage.java
@@ -1,30 +1,30 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.preferences;
-
-import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.DiagramPreferencePage;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class DiagramGeneralPreferencePage extends DiagramPreferencePage {
-
- /**
- * @generated
- */
- public DiagramGeneralPreferencePage() {
- setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
- setPreferenceKey(DeploymentDiagramEditPart.MODEL_ID);
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.preferences;
+
+import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.DiagramPreferencePage;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+public class DiagramGeneralPreferencePage extends DiagramPreferencePage {
+
+ /**
+ * @generated
+ */
+ public DiagramGeneralPreferencePage() {
+ setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
+ setPreferenceKey(DeploymentDiagramEditPart.MODEL_ID);
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramPreferenceInitializer.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramPreferenceInitializer.java
index b049cdb617c..329ce59cb97 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramPreferenceInitializer.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramPreferenceInitializer.java
@@ -1,48 +1,48 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.preferences;
-
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePreferencePage;
-import org.eclipse.gmf.runtime.diagram.ui.preferences.ConnectionsPreferencePage;
-import org.eclipse.gmf.runtime.diagram.ui.preferences.DiagramsPreferencePage;
-import org.eclipse.gmf.runtime.diagram.ui.preferences.PrintingPreferencePage;
-import org.eclipse.gmf.runtime.diagram.ui.preferences.RulerGridPreferencePage;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class DiagramPreferenceInitializer extends AbstractPreferenceInitializer {
-
- /**
- * @generated
- */
- @Override
- public void initializeDefaultPreferences() {
- IPreferenceStore store = getPreferenceStore();
- DiagramsPreferencePage.initDefaults(store);
- AppearancePreferencePage.initDefaults(store);
- ConnectionsPreferencePage.initDefaults(store);
- PrintingPreferencePage.initDefaults(store);
- RulerGridPreferencePage.initDefaults(store);
-
- }
-
- /**
- * @generated
- */
- protected IPreferenceStore getPreferenceStore() {
- return UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePreferencePage;
+import org.eclipse.gmf.runtime.diagram.ui.preferences.ConnectionsPreferencePage;
+import org.eclipse.gmf.runtime.diagram.ui.preferences.DiagramsPreferencePage;
+import org.eclipse.gmf.runtime.diagram.ui.preferences.PrintingPreferencePage;
+import org.eclipse.gmf.runtime.diagram.ui.preferences.RulerGridPreferencePage;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+public class DiagramPreferenceInitializer extends AbstractPreferenceInitializer {
+
+ /**
+ * @generated
+ */
+ @Override
+ public void initializeDefaultPreferences() {
+ IPreferenceStore store = getPreferenceStore();
+ DiagramGeneralPreferencePage.initDefaults(store);
+ DiagramAppearancePreferencePage.initDefaults(store);
+ DiagramConnectionsPreferencePage.initDefaults(store);
+ DiagramPrintingPreferencePage.initDefaults(store);
+ DiagramRulersAndGridPreferencePage.initDefaults(store);
+
+ }
+
+ /**
+ * @generated
+ */
+ protected IPreferenceStore getPreferenceStore() {
+ return UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramPrintingPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramPrintingPreferencePage.java
index be29adbe51d..77315572c18 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramPrintingPreferencePage.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramPrintingPreferencePage.java
@@ -1,28 +1,28 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.preferences;
-
-import org.eclipse.gmf.runtime.diagram.ui.preferences.PrintingPreferencePage;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class DiagramPrintingPreferencePage extends PrintingPreferencePage {
-
- /**
- * @generated
- */
- public DiagramPrintingPreferencePage() {
- setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.preferences;
+
+import org.eclipse.gmf.runtime.diagram.ui.preferences.PrintingPreferencePage;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+public class DiagramPrintingPreferencePage extends PrintingPreferencePage {
+
+ /**
+ * @generated
+ */
+ public DiagramPrintingPreferencePage() {
+ setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramRulersAndGridPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramRulersAndGridPreferencePage.java
index ff9e811bd7e..bcdae83c296 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramRulersAndGridPreferencePage.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/preferences/DiagramRulersAndGridPreferencePage.java
@@ -1,28 +1,28 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.preferences;
-
-import org.eclipse.gmf.runtime.diagram.ui.preferences.RulerGridPreferencePage;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
-
-/**
- * @generated
- */
-public class DiagramRulersAndGridPreferencePage extends RulerGridPreferencePage {
-
- /**
- * @generated
- */
- public DiagramRulersAndGridPreferencePage() {
- setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.preferences;
+
+import org.eclipse.gmf.runtime.diagram.ui.preferences.RulerGridPreferencePage;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+public class DiagramRulersAndGridPreferencePage extends RulerGridPreferencePage {
+
+ /**
+ * @generated
+ */
+ public DiagramRulersAndGridPreferencePage() {
+ setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/ElementInitializers.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/ElementInitializers.java
index 8a266550d72..5673f61c8aa 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/ElementInitializers.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/ElementInitializers.java
@@ -1,685 +1,654 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.providers;
-
-import org.eclipse.papyrus.uml.diagram.deployment.expressions.UMLOCLFactory;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil;
-import org.eclipse.uml2.uml.Artifact;
-import org.eclipse.uml2.uml.Comment;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.Dependency;
-import org.eclipse.uml2.uml.Deployment;
-import org.eclipse.uml2.uml.Device;
-import org.eclipse.uml2.uml.ExecutionEnvironment;
-import org.eclipse.uml2.uml.LiteralString;
-import org.eclipse.uml2.uml.Manifestation;
-import org.eclipse.uml2.uml.Model;
-import org.eclipse.uml2.uml.Node;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-/**
- * @generated
- */
-public class ElementInitializers {
-
- protected ElementInitializers() {
- // use #getInstance to access cached instance
- }
-
- /**
- * @generated
- */
- public void init_Model_2010(Model instance) {
- try {
- Object value_0 = name_Model_2010(instance);
- if (value_0 != null) {
- instance.setName(
- (String) value_0
- );
- }
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Package_2009(Package instance) {
- try {
- Object value_0 = name_Package_2009(instance);
- if (value_0 != null) {
- instance.setName(
- (String) value_0
- );
- }
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Constraint_2005(Constraint instance) {
- try {
- Object value_0 = name_Constraint_2005(instance);
- if (value_0 != null) {
- instance.setName(
- (String) value_0
- );
- }
- Object value_1 = specification_Constraint_2005(instance);
- if (value_1 != null) {
- instance.setSpecification(
- (ValueSpecification) value_1
- );
- }
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Comment_2001(Comment instance) {
- try {
- Object value_0 = body_Comment_2001(instance);
- if (value_0 != null) {
- instance.setBody(
- (String) value_0
- );
- }
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_ExecutionEnvironment_2002(ExecutionEnvironment instance) {
- try {
- Object value_0 = name_ExecutionEnvironment_2002(instance);
- if (value_0 != null) {
- instance.setName(
- (String) value_0
- );
- }
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Device_2003(Device instance) {
- try {
- Object value_0 = name_Device_2003(instance);
- if (value_0 != null) {
- instance.setName(
- (String) value_0
- );
- }
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Artifact_2006(Artifact instance) {
- try {
- Object value_0 = name_Artifact_2006(instance);
- if (value_0 != null) {
- instance.setName(
- (String) value_0
- );
- }
- Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getArtifact(), null).evaluate(instance);
- if (value_1 != null) {
- instance.setFileName(
- (String) value_1
- );
- }
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Node_2008(Node instance) {
- try {
- Object value_0 = name_Node_2008(instance);
- if (value_0 != null) {
- instance.setName(
- (String) value_0
- );
- }
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Model_49(Model instance) {
- try {
- Object value_0 = name_Model_49(instance);
- if (value_0 != null) {
- instance.setName(
- (String) value_0
- );
- }
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Package_36(Package instance) {
- try {
- Object value_0 = name_Package_36(instance);
- if (value_0 != null) {
- instance.setName(
- (String) value_0
- );
- }
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Device_16(Device instance) {
- try {
- Object value_0 = name_Device_16(instance);
- if (value_0 != null) {
- instance.setName(
- (String) value_0
- );
- }
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Device_44(Device instance) {
- try {
- Object value_0 = name_Device_44(instance);
- if (value_0 != null) {
- instance.setName(
- (String) value_0
- );
- }
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_ExecutionEnvironment_21(ExecutionEnvironment instance) {
- try {
- Object value_0 = name_ExecutionEnvironment_21(instance);
- if (value_0 != null) {
- instance.setName(
- (String) value_0
- );
- }
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_ExecutionEnvironment_46(ExecutionEnvironment instance) {
- try {
- Object value_0 = name_ExecutionEnvironment_46(instance);
- if (value_0 != null) {
- instance.setName(
- (String) value_0
- );
- }
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Node_23(Node instance) {
- try {
- Object value_0 = name_Node_23(instance);
- if (value_0 != null) {
- instance.setName(
- (String) value_0
- );
- }
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Node_42(Node instance) {
- try {
- Object value_0 = name_Node_42(instance);
- if (value_0 != null) {
- instance.setName(
- (String) value_0
- );
- }
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Artifact_25(Artifact instance) {
- try {
- Object value_0 = name_Artifact_25(instance);
- if (value_0 != null) {
- instance.setName(
- (String) value_0
- );
- }
- Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getArtifact(), null).evaluate(instance);
- if (value_1 != null) {
- instance.setFileName(
- (String) value_1
- );
- }
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Artifact_28(Artifact instance) {
- try {
- Object value_0 = name_Artifact_28(instance);
- if (value_0 != null) {
- instance.setName(
- (String) value_0
- );
- }
- Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getArtifact(), null).evaluate(instance);
- if (value_1 != null) {
- instance.setFileName(
- (String) value_1
- );
- }
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Artifact_40(Artifact instance) {
- try {
- Object value_0 = name_Artifact_40(instance);
- if (value_0 != null) {
- instance.setName(
- (String) value_0
- );
- }
- Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getArtifact(), null).evaluate(instance);
- if (value_1 != null) {
- instance.setFileName(
- (String) value_1
- );
- }
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Comment_54(Comment instance) {
- try {
- Object value_0 = body_Comment_54(instance);
- if (value_0 != null) {
- instance.setBody(
- (String) value_0
- );
- }
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Constraint_56(Constraint instance) {
- try {
- Object value_0 = name_Constraint_56(instance);
- if (value_0 != null) {
- instance.setName(
- (String) value_0
- );
- }
- Object value_1 = specification_Constraint_56(instance);
- if (value_1 != null) {
- instance.setSpecification(
- (ValueSpecification) value_1
- );
- }
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Deployment_4001(Deployment instance) {
- try {
- Object value_0 = name_Deployment_4001(instance);
- if (value_0 != null) {
- instance.setName(
- (String) value_0
- );
- }
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Manifestation_4002(Manifestation instance) {
- try {
- Object value_0 = name_Manifestation_4002(instance);
- if (value_0 != null) {
- instance.setName(
- (String) value_0
- );
- }
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Dependency_4004(Dependency instance) {
- try {
- Object value_0 = name_Dependency_4004(instance);
- if (value_0 != null) {
- instance.setName(
- (String) value_0
- );
- }
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Dependency_4010(Dependency instance) {
- try {
- Object value_0 = name_Dependency_4010(instance);
- if (value_0 != null) {
- instance.setName(
- (String) value_0
- );
- }
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- private String name_Model_2010(Model it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Package_2009(Package it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Constraint_2005(Constraint it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private ValueSpecification specification_Constraint_2005(Constraint it) {
- // Constraint specification init
- LiteralString value = UMLFactory.eINSTANCE.createLiteralString();
- value.setValue("");
- return value;
- }
-
- /**
- * @generated
- */
- private String body_Comment_2001(Comment it) {
- // Comment body init
- return "";
- }
-
- /**
- * @generated
- */
- private String name_ExecutionEnvironment_2002(ExecutionEnvironment it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Device_2003(Device it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Artifact_2006(Artifact it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Node_2008(Node it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Model_49(Model it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Package_36(Package it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Device_16(Device it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Device_44(Device it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_ExecutionEnvironment_21(ExecutionEnvironment it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_ExecutionEnvironment_46(ExecutionEnvironment it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Node_23(Node it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Node_42(Node it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Artifact_25(Artifact it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Artifact_28(Artifact it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Artifact_40(Artifact it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String body_Comment_54(Comment it) {
- // Comment body init
- return "";
- }
-
- /**
- * @generated
- */
- private String name_Constraint_56(Constraint it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private ValueSpecification specification_Constraint_56(Constraint it) {
- // Constraint specification init
- LiteralString value = UMLFactory.eINSTANCE.createLiteralString();
- value.setValue("");
- return value;
- }
-
- /**
- * @generated
- */
- private String name_Deployment_4001(Deployment it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Manifestation_4002(Manifestation it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Dependency_4004(Dependency it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Dependency_4010(Dependency it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- public static ElementInitializers getInstance() {
- ElementInitializers cached = UMLDiagramEditorPlugin.getInstance().getElementInitializers();
- if (cached == null) {
- UMLDiagramEditorPlugin.getInstance().setElementInitializers(cached = new ElementInitializers());
- }
- return cached;
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.providers;
+
+import org.eclipse.papyrus.uml.diagram.deployment.expressions.UMLOCLFactory;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil;
+import org.eclipse.uml2.uml.Artifact;
+import org.eclipse.uml2.uml.Comment;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.Dependency;
+import org.eclipse.uml2.uml.Deployment;
+import org.eclipse.uml2.uml.Device;
+import org.eclipse.uml2.uml.ExecutionEnvironment;
+import org.eclipse.uml2.uml.LiteralString;
+import org.eclipse.uml2.uml.Manifestation;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.Node;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.ValueSpecification;
+
+/**
+ * @generated
+ */
+public class ElementInitializers {
+
+ protected ElementInitializers() {
+ // use #getInstance to access cached instance
+ }
+
+ /**
+ * @generated
+ */
+ public void init_Model_2010(Model instance) {
+ try {
+ Object value_0 = name_Model_2010(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0);
+ }
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void init_Package_2009(Package instance) {
+ try {
+ Object value_0 = name_Package_2009(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0);
+ }
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void init_Constraint_2005(Constraint instance) {
+ try {
+ Object value_0 = name_Constraint_2005(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0);
+ }
+ Object value_1 = specification_Constraint_2005(instance);
+ if (value_1 != null) {
+ instance.setSpecification(
+ (ValueSpecification) value_1);
+ }
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void init_Comment_2001(Comment instance) {
+ try {
+ Object value_0 = body_Comment_2001(instance);
+ if (value_0 != null) {
+ instance.setBody(
+ (String) value_0);
+ }
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void init_ExecutionEnvironment_2002(ExecutionEnvironment instance) {
+ try {
+ Object value_0 = name_ExecutionEnvironment_2002(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0);
+ }
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void init_Device_2003(Device instance) {
+ try {
+ Object value_0 = name_Device_2003(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0);
+ }
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void init_Artifact_2006(Artifact instance) {
+ try {
+ Object value_0 = name_Artifact_2006(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0);
+ }
+ Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getArtifact(), null).evaluate(instance);
+ if (value_1 != null) {
+ instance.setFileName(
+ (String) value_1);
+ }
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void init_Node_2008(Node instance) {
+ try {
+ Object value_0 = name_Node_2008(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0);
+ }
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void init_Model_49(Model instance) {
+ try {
+ Object value_0 = name_Model_49(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0);
+ }
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void init_Package_36(Package instance) {
+ try {
+ Object value_0 = name_Package_36(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0);
+ }
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void init_Device_16(Device instance) {
+ try {
+ Object value_0 = name_Device_16(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0);
+ }
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void init_Device_44(Device instance) {
+ try {
+ Object value_0 = name_Device_44(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0);
+ }
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void init_ExecutionEnvironment_21(ExecutionEnvironment instance) {
+ try {
+ Object value_0 = name_ExecutionEnvironment_21(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0);
+ }
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void init_ExecutionEnvironment_46(ExecutionEnvironment instance) {
+ try {
+ Object value_0 = name_ExecutionEnvironment_46(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0);
+ }
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void init_Node_23(Node instance) {
+ try {
+ Object value_0 = name_Node_23(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0);
+ }
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void init_Node_42(Node instance) {
+ try {
+ Object value_0 = name_Node_42(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0);
+ }
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void init_Artifact_25(Artifact instance) {
+ try {
+ Object value_0 = name_Artifact_25(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0);
+ }
+ Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getArtifact(), null).evaluate(instance);
+ if (value_1 != null) {
+ instance.setFileName(
+ (String) value_1);
+ }
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void init_Artifact_28(Artifact instance) {
+ try {
+ Object value_0 = name_Artifact_28(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0);
+ }
+ Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getArtifact(), null).evaluate(instance);
+ if (value_1 != null) {
+ instance.setFileName(
+ (String) value_1);
+ }
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void init_Artifact_40(Artifact instance) {
+ try {
+ Object value_0 = name_Artifact_40(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0);
+ }
+ Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getArtifact(), null).evaluate(instance);
+ if (value_1 != null) {
+ instance.setFileName(
+ (String) value_1);
+ }
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void init_Comment_54(Comment instance) {
+ try {
+ Object value_0 = body_Comment_54(instance);
+ if (value_0 != null) {
+ instance.setBody(
+ (String) value_0);
+ }
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void init_Constraint_56(Constraint instance) {
+ try {
+ Object value_0 = name_Constraint_56(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0);
+ }
+ Object value_1 = specification_Constraint_56(instance);
+ if (value_1 != null) {
+ instance.setSpecification(
+ (ValueSpecification) value_1);
+ }
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void init_Deployment_4001(Deployment instance) {
+ try {
+ Object value_0 = name_Deployment_4001(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0);
+ }
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void init_Manifestation_4002(Manifestation instance) {
+ try {
+ Object value_0 = name_Manifestation_4002(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0);
+ }
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void init_Dependency_4004(Dependency instance) {
+ try {
+ Object value_0 = name_Dependency_4004(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0);
+ }
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void init_Dependency_4010(Dependency instance) {
+ try {
+ Object value_0 = name_Dependency_4010(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0);
+ }
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Model_2010(Model it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Package_2009(Package it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Constraint_2005(Constraint it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private ValueSpecification specification_Constraint_2005(Constraint it) {
+ // Constraint specification init
+ LiteralString value = UMLFactory.eINSTANCE.createLiteralString();
+ value.setValue("");
+ return value;
+ }
+
+ /**
+ * @generated
+ */
+ private String body_Comment_2001(Comment it) {
+ // Comment body init
+ return "";
+ }
+
+ /**
+ * @generated
+ */
+ private String name_ExecutionEnvironment_2002(ExecutionEnvironment it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Device_2003(Device it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Artifact_2006(Artifact it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Node_2008(Node it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Model_49(Model it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Package_36(Package it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Device_16(Device it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Device_44(Device it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_ExecutionEnvironment_21(ExecutionEnvironment it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_ExecutionEnvironment_46(ExecutionEnvironment it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Node_23(Node it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Node_42(Node it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Artifact_25(Artifact it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Artifact_28(Artifact it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Artifact_40(Artifact it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String body_Comment_54(Comment it) {
+ // Comment body init
+ return "";
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Constraint_56(Constraint it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private ValueSpecification specification_Constraint_56(Constraint it) {
+ // Constraint specification init
+ LiteralString value = UMLFactory.eINSTANCE.createLiteralString();
+ value.setValue("");
+ return value;
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Deployment_4001(Deployment it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Manifestation_4002(Manifestation it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Dependency_4004(Dependency it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Dependency_4010(Dependency it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ public static ElementInitializers getInstance() {
+ ElementInitializers cached = UMLDiagramEditorPlugin.getInstance().getElementInitializers();
+ if (cached == null) {
+ UMLDiagramEditorPlugin.getInstance().setElementInitializers(cached = new ElementInitializers());
+ }
+ return cached;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLEditPartProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLEditPartProvider.java
index 509b5380a0f..440a5c7398a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLEditPartProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLEditPartProvider.java
@@ -1,32 +1,32 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.providers;
-
-import org.eclipse.gmf.tooling.runtime.providers.DefaultEditPartProvider;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.UMLEditPartFactory;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-
-/**
- * @generated
- */
-public class UMLEditPartProvider extends DefaultEditPartProvider {
-
- /**
- * @generated
- */
- public UMLEditPartProvider() {
- super(new UMLEditPartFactory(),
- UMLVisualIDRegistry.TYPED_INSTANCE,
- DeploymentDiagramEditPart.MODEL_ID);
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.providers;
+
+import org.eclipse.gmf.tooling.runtime.providers.DefaultEditPartProvider;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.UMLEditPartFactory;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class UMLEditPartProvider extends DefaultEditPartProvider {
+
+ /**
+ * @generated
+ */
+ public UMLEditPartProvider() {
+ super(new UMLEditPartFactory(),
+ UMLVisualIDRegistry.TYPED_INSTANCE,
+ DeploymentDiagramEditPart.MODEL_ID);
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLElementTypes.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLElementTypes.java
index 8901a77aa6f..41eb735d248 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLElementTypes.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLElementTypes.java
@@ -1,530 +1,556 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.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.ENamedElement;
-import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.tooling.runtime.providers.DiagramElementTypeImages;
-import org.eclipse.gmf.tooling.runtime.providers.DiagramElementTypes;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPartACN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DefaultNamedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNodeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.LinkDescriptorEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedArtifactNodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedDeviceEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedExecutionEnvironmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedNodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class UMLElementTypes {
-
- /**
- * @generated
- */
- private UMLElementTypes() {
- }
-
- /**
- * @generated
- */
- private static Map<IElementType, ENamedElement> elements;
-
- /**
- * @generated
- */
- private static DiagramElementTypeImages elementTypeImages = new DiagramElementTypeImages(UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory());
-
- /**
- * @generated
- */
- private static Set<IElementType> KNOWN_ELEMENT_TYPES;
-
- /**
- * @generated
- */
- public static final IElementType Package_1000 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Package_1000"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Dependency_2011 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Dependency_2011"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Model_2010 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Model_2010"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Package_2009 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Package_2009"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Constraint_2005 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Constraint_2005"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Comment_2001 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Comment_2001"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType ExecutionEnvironment_2002 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_2002"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Device_2003 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Device_2003"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Artifact_2006 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Artifact_2006"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Node_2008 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Node_2008"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType NamedElement_2012 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.NamedElement_2012"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Model_49 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Model_49"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Package_36 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Package_36"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Device_16 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Device_16"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Device_44 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Device_44"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType ExecutionEnvironment_21 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_21"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType ExecutionEnvironment_46 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_46"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Node_23 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Node_23"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Node_42 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Node_42"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Artifact_25 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Artifact_25"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Artifact_28 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Artifact_28"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Artifact_40 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Artifact_40"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Comment_54 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Comment_54"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Constraint_56 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Constraint_56"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Link_4005 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Link_4005"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType CommentAnnotatedElement_4008 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.CommentAnnotatedElement_4006"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType ConstraintConstrainedElement_4009 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.ConstraintConstrainedElement_4007"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Deployment_4001 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Deployment_4001"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Manifestation_4002 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Manifestation_4002"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Generalization_4003 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Generalization_4003"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Dependency_4004 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Dependency_4004"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final IElementType Dependency_4010 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Dependency_4010"); //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static ImageDescriptor getImageDescriptor(ENamedElement element) {
- return elementTypeImages.getImageDescriptor(element);
- }
-
- /**
- * @generated
- */
- public static Image getImage(ENamedElement element) {
- return elementTypeImages.getImage(element);
- }
-
- /**
- * @generated
- */
- public static ImageDescriptor getImageDescriptor(IAdaptable hint) {
- return getImageDescriptor(getElement(hint));
- }
-
- /**
- * @generated
- */
- public static Image getImage(IAdaptable hint) {
- return getImage(getElement(hint));
- }
-
- /**
- * Returns 'type' of the ecore object associated with the hint.
- *
- * @generated
- */
- public static synchronized 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(Dependency_2011, UMLPackage.eINSTANCE.getDependency());
-
-
- elements.put(Model_2010, UMLPackage.eINSTANCE.getModel());
-
-
- elements.put(Package_2009, UMLPackage.eINSTANCE.getPackage());
-
-
- elements.put(Constraint_2005, UMLPackage.eINSTANCE.getConstraint());
-
-
- elements.put(Comment_2001, UMLPackage.eINSTANCE.getComment());
-
-
- elements.put(ExecutionEnvironment_2002, UMLPackage.eINSTANCE.getExecutionEnvironment());
-
-
- elements.put(Device_2003, UMLPackage.eINSTANCE.getDevice());
-
-
- elements.put(Artifact_2006, UMLPackage.eINSTANCE.getArtifact());
-
-
- elements.put(Node_2008, UMLPackage.eINSTANCE.getNode());
-
-
- elements.put(NamedElement_2012, UMLPackage.eINSTANCE.getNamedElement());
-
-
- elements.put(Model_49, UMLPackage.eINSTANCE.getModel());
-
-
- elements.put(Package_36, UMLPackage.eINSTANCE.getPackage());
-
-
- elements.put(Device_16, UMLPackage.eINSTANCE.getDevice());
-
-
- elements.put(Device_44, UMLPackage.eINSTANCE.getDevice());
-
-
- elements.put(ExecutionEnvironment_21, UMLPackage.eINSTANCE.getExecutionEnvironment());
-
-
- elements.put(ExecutionEnvironment_46, UMLPackage.eINSTANCE.getExecutionEnvironment());
-
-
- elements.put(Node_23, UMLPackage.eINSTANCE.getNode());
-
-
- elements.put(Node_42, UMLPackage.eINSTANCE.getNode());
-
-
- elements.put(Artifact_25, UMLPackage.eINSTANCE.getArtifact());
-
-
- elements.put(Artifact_28, UMLPackage.eINSTANCE.getArtifact());
-
-
- elements.put(Artifact_40, UMLPackage.eINSTANCE.getArtifact());
-
-
- elements.put(Comment_54, UMLPackage.eINSTANCE.getComment());
-
-
- elements.put(Constraint_56, UMLPackage.eINSTANCE.getConstraint());
-
- elements.put(CommentAnnotatedElement_4008, UMLPackage.eINSTANCE.getComment_AnnotatedElement());
-
- elements.put(ConstraintConstrainedElement_4009, UMLPackage.eINSTANCE.getConstraint_ConstrainedElement());
-
-
- elements.put(Deployment_4001, UMLPackage.eINSTANCE.getDeployment());
-
-
- elements.put(Manifestation_4002, UMLPackage.eINSTANCE.getManifestation());
-
-
- elements.put(Generalization_4003, UMLPackage.eINSTANCE.getGeneralization());
-
-
- elements.put(Dependency_4004, UMLPackage.eINSTANCE.getDependency());
-
-
- elements.put(Dependency_4010, UMLPackage.eINSTANCE.getDependency());
- }
- return elements.get(type);
- }
-
- /**
- * @generated
- */
- private static IElementType getElementType(String id) {
- return ElementTypeRegistry.getInstance().getType(id);
- }
-
- /**
- * @generated
- */
- public static synchronized 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(Dependency_2011);
- KNOWN_ELEMENT_TYPES.add(Model_2010);
- KNOWN_ELEMENT_TYPES.add(Package_2009);
- KNOWN_ELEMENT_TYPES.add(Constraint_2005);
- KNOWN_ELEMENT_TYPES.add(Comment_2001);
- KNOWN_ELEMENT_TYPES.add(ExecutionEnvironment_2002);
- KNOWN_ELEMENT_TYPES.add(Device_2003);
- KNOWN_ELEMENT_TYPES.add(Artifact_2006);
- KNOWN_ELEMENT_TYPES.add(Node_2008);
- KNOWN_ELEMENT_TYPES.add(NamedElement_2012);
- KNOWN_ELEMENT_TYPES.add(Model_49);
- KNOWN_ELEMENT_TYPES.add(Package_36);
- KNOWN_ELEMENT_TYPES.add(Device_16);
- KNOWN_ELEMENT_TYPES.add(Device_44);
- KNOWN_ELEMENT_TYPES.add(ExecutionEnvironment_21);
- KNOWN_ELEMENT_TYPES.add(ExecutionEnvironment_46);
- KNOWN_ELEMENT_TYPES.add(Node_23);
- KNOWN_ELEMENT_TYPES.add(Node_42);
- KNOWN_ELEMENT_TYPES.add(Artifact_25);
- KNOWN_ELEMENT_TYPES.add(Artifact_28);
- KNOWN_ELEMENT_TYPES.add(Artifact_40);
- KNOWN_ELEMENT_TYPES.add(Comment_54);
- KNOWN_ELEMENT_TYPES.add(Constraint_56);
- KNOWN_ELEMENT_TYPES.add(Link_4005);
- KNOWN_ELEMENT_TYPES.add(CommentAnnotatedElement_4008);
- KNOWN_ELEMENT_TYPES.add(ConstraintConstrainedElement_4009);
- KNOWN_ELEMENT_TYPES.add(Deployment_4001);
- KNOWN_ELEMENT_TYPES.add(Manifestation_4002);
- KNOWN_ELEMENT_TYPES.add(Generalization_4003);
- KNOWN_ELEMENT_TYPES.add(Dependency_4004);
- KNOWN_ELEMENT_TYPES.add(Dependency_4010);
- }
- return KNOWN_ELEMENT_TYPES.contains(elementType);
- }
-
- /**
- * @generated
- */
- public static IElementType getElementType(int visualID) {
- switch (visualID) {
- case DeploymentDiagramEditPart.VISUAL_ID:
- return Package_1000;
- case DependencyNodeEditPart.VISUAL_ID:
- return Dependency_2011;
- case ModelEditPart.VISUAL_ID:
- return Model_2010;
- case PackageEditPart.VISUAL_ID:
- return Package_2009;
- case ConstraintEditPart.VISUAL_ID:
- return Constraint_2005;
- case CommentEditPart.VISUAL_ID:
- return Comment_2001;
- case ExecutionEnvironmentEditPart.VISUAL_ID:
- return ExecutionEnvironment_2002;
- case DeviceEditPart.VISUAL_ID:
- return Device_2003;
- case ArtifactEditPart.VISUAL_ID:
- return Artifact_2006;
- case NodeEditPart.VISUAL_ID:
- return Node_2008;
- case DefaultNamedElementEditPart.VISUAL_ID:
- return NamedElement_2012;
- case ModelEditPartCN.VISUAL_ID:
- return Model_49;
- case PackageEditPartCN.VISUAL_ID:
- return Package_36;
- case DeviceEditPartCN.VISUAL_ID:
- return Device_16;
- case NestedDeviceEditPartCN.VISUAL_ID:
- return Device_44;
- case ExecutionEnvironmentEditPartCN.VISUAL_ID:
- return ExecutionEnvironment_21;
- case NestedExecutionEnvironmentEditPartCN.VISUAL_ID:
- return ExecutionEnvironment_46;
- case NodeEditPartCN.VISUAL_ID:
- return Node_23;
- case NestedNodeEditPartCN.VISUAL_ID:
- return Node_42;
- case ArtifactEditPartCN.VISUAL_ID:
- return Artifact_25;
- case ArtifactEditPartACN.VISUAL_ID:
- return Artifact_28;
- case NestedArtifactNodeEditPartCN.VISUAL_ID:
- return Artifact_40;
- case CommentEditPartCN.VISUAL_ID:
- return Comment_54;
- case ConstraintEditPartCN.VISUAL_ID:
- return Constraint_56;
- case LinkDescriptorEditPart.VISUAL_ID:
- return Link_4005;
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return CommentAnnotatedElement_4008;
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return ConstraintConstrainedElement_4009;
- case DeploymentEditPart.VISUAL_ID:
- return Deployment_4001;
- case ManifestationEditPart.VISUAL_ID:
- return Manifestation_4002;
- case GeneralizationEditPart.VISUAL_ID:
- return Generalization_4003;
- case DependencyEditPart.VISUAL_ID:
- return Dependency_4004;
- case DependencyBranchEditPart.VISUAL_ID:
- return Dependency_4010;
- }
- return null;
- }
-
- /**
- * @generated
- */
- public static final DiagramElementTypes TYPED_INSTANCE = new DiagramElementTypes(elementTypeImages) {
-
- /**
- * @generated
- */
- @Override
- public boolean isKnownElementType(IElementType elementType) {
- return org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes.isKnownElementType(elementType);
- }
-
- /**
- * @generated
- */
- @Override
- public IElementType getElementTypeForVisualId(int visualID) {
- return org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes.getElementType(visualID);
- }
-
- /**
- * @generated
- */
- @Override
- public ENamedElement getDefiningNamedElement(IAdaptable elementTypeAdapter) {
- return org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes.getElement(elementTypeAdapter);
- }
- };
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.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.ENamedElement;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.tooling.runtime.providers.DiagramElementTypeImages;
+import org.eclipse.gmf.tooling.runtime.providers.DiagramElementTypes;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPartACN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DefaultNamedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNodeEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.LinkDescriptorEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedArtifactNodeEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedDeviceEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedExecutionEnvironmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedNodeEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class UMLElementTypes {
+
+ /**
+ * @generated
+ */
+ private UMLElementTypes() {
+ }
+
+ /**
+ * @generated
+ */
+ private static Map<IElementType, ENamedElement> elements;
+
+ /**
+ * @generated
+ */
+ private static DiagramElementTypeImages elementTypeImages = new DiagramElementTypeImages(UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory());
+
+ /**
+ * @generated
+ */
+ private static Set<IElementType> KNOWN_ELEMENT_TYPES;
+
+ /**
+ * @generated
+ */
+ public static final IElementType Package_1000 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Package_1000"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Dependency_2011 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Dependency_2011"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Model_2010 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Model_2010"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Package_2009 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Package_2009"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Constraint_2005 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Constraint_2005"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Comment_2001 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Comment_2001"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType ExecutionEnvironment_2002 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_2002"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Device_2003 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Device_2003"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Artifact_2006 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Artifact_2006"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Node_2008 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Node_2008"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType NamedElement_2012 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.NamedElement_2012"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Model_49 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Model_49"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Package_36 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Package_36"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Device_16 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Device_16"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Device_44 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Device_44"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType ExecutionEnvironment_21 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_21"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType ExecutionEnvironment_46 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.ExecutionEnvironment_46"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Node_23 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Node_23"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Node_42 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Node_42"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Artifact_25 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Artifact_25"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Artifact_28 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Artifact_28"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Artifact_40 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Artifact_40"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Comment_54 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Comment_54"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Constraint_56 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Constraint_56"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Link_4005 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Link_4005"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType CommentAnnotatedElement_4008 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.CommentAnnotatedElement_4006"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType ConstraintConstrainedElement_4009 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.ConstraintConstrainedElement_4007"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Deployment_4001 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Deployment_4001"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Manifestation_4002 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Manifestation_4002"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Generalization_4003 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Generalization_4003"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Dependency_4004 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Dependency_4004"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType Dependency_4010 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Dependency_4010"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static ImageDescriptor getImageDescriptor(ENamedElement element) {
+ return elementTypeImages.getImageDescriptor(element);
+ }
+
+ /**
+ * @generated
+ */
+ public static Image getImage(ENamedElement element) {
+ return elementTypeImages.getImage(element);
+ }
+
+ /**
+ * @generated
+ */
+ public static ImageDescriptor getImageDescriptor(IAdaptable hint) {
+ return getImageDescriptor(getElement(hint));
+ }
+
+ /**
+ * @generated
+ */
+ public static Image getImage(IAdaptable hint) {
+ return getImage(getElement(hint));
+ }
+
+ /**
+ * Returns 'type' of the ecore object associated with the hint.
+ *
+ * @generated
+ */
+ public static synchronized 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(Dependency_2011, UMLPackage.eINSTANCE.getDependency());
+
+
+ elements.put(Model_2010, UMLPackage.eINSTANCE.getModel());
+
+
+ elements.put(Package_2009, UMLPackage.eINSTANCE.getPackage());
+
+
+ elements.put(Constraint_2005, UMLPackage.eINSTANCE.getConstraint());
+
+
+ elements.put(Comment_2001, UMLPackage.eINSTANCE.getComment());
+
+
+ elements.put(ExecutionEnvironment_2002, UMLPackage.eINSTANCE.getExecutionEnvironment());
+
+
+ elements.put(Device_2003, UMLPackage.eINSTANCE.getDevice());
+
+
+ elements.put(Artifact_2006, UMLPackage.eINSTANCE.getArtifact());
+
+
+ elements.put(Node_2008, UMLPackage.eINSTANCE.getNode());
+
+
+ elements.put(NamedElement_2012, UMLPackage.eINSTANCE.getNamedElement());
+
+
+ elements.put(Model_49, UMLPackage.eINSTANCE.getModel());
+
+
+ elements.put(Package_36, UMLPackage.eINSTANCE.getPackage());
+
+
+ elements.put(Device_16, UMLPackage.eINSTANCE.getDevice());
+
+
+ elements.put(Device_44, UMLPackage.eINSTANCE.getDevice());
+
+
+ elements.put(ExecutionEnvironment_21, UMLPackage.eINSTANCE.getExecutionEnvironment());
+
+
+ elements.put(ExecutionEnvironment_46, UMLPackage.eINSTANCE.getExecutionEnvironment());
+
+
+ elements.put(Node_23, UMLPackage.eINSTANCE.getNode());
+
+
+ elements.put(Node_42, UMLPackage.eINSTANCE.getNode());
+
+
+ elements.put(Artifact_25, UMLPackage.eINSTANCE.getArtifact());
+
+
+ elements.put(Artifact_28, UMLPackage.eINSTANCE.getArtifact());
+
+
+ elements.put(Artifact_40, UMLPackage.eINSTANCE.getArtifact());
+
+
+ elements.put(Comment_54, UMLPackage.eINSTANCE.getComment());
+
+
+ elements.put(Constraint_56, UMLPackage.eINSTANCE.getConstraint());
+
+ elements.put(CommentAnnotatedElement_4008, UMLPackage.eINSTANCE.getComment_AnnotatedElement());
+
+ elements.put(ConstraintConstrainedElement_4009, UMLPackage.eINSTANCE.getConstraint_ConstrainedElement());
+
+
+ elements.put(Deployment_4001, UMLPackage.eINSTANCE.getDeployment());
+
+
+ elements.put(Manifestation_4002, UMLPackage.eINSTANCE.getManifestation());
+
+
+ elements.put(Generalization_4003, UMLPackage.eINSTANCE.getGeneralization());
+
+
+ elements.put(Dependency_4004, UMLPackage.eINSTANCE.getDependency());
+
+
+ elements.put(Dependency_4010, UMLPackage.eINSTANCE.getDependency());
+ }
+ return elements.get(type);
+ }
+
+ /**
+ * @generated
+ */
+ private static IElementType getElementType(String id) {
+ return ElementTypeRegistry.getInstance().getType(id);
+ }
+
+ /**
+ * @generated
+ */
+ public static synchronized 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(Dependency_2011);
+ KNOWN_ELEMENT_TYPES.add(Model_2010);
+ KNOWN_ELEMENT_TYPES.add(Package_2009);
+ KNOWN_ELEMENT_TYPES.add(Constraint_2005);
+ KNOWN_ELEMENT_TYPES.add(Comment_2001);
+ KNOWN_ELEMENT_TYPES.add(ExecutionEnvironment_2002);
+ KNOWN_ELEMENT_TYPES.add(Device_2003);
+ KNOWN_ELEMENT_TYPES.add(Artifact_2006);
+ KNOWN_ELEMENT_TYPES.add(Node_2008);
+ KNOWN_ELEMENT_TYPES.add(NamedElement_2012);
+ KNOWN_ELEMENT_TYPES.add(Model_49);
+ KNOWN_ELEMENT_TYPES.add(Package_36);
+ KNOWN_ELEMENT_TYPES.add(Device_16);
+ KNOWN_ELEMENT_TYPES.add(Device_44);
+ KNOWN_ELEMENT_TYPES.add(ExecutionEnvironment_21);
+ KNOWN_ELEMENT_TYPES.add(ExecutionEnvironment_46);
+ KNOWN_ELEMENT_TYPES.add(Node_23);
+ KNOWN_ELEMENT_TYPES.add(Node_42);
+ KNOWN_ELEMENT_TYPES.add(Artifact_25);
+ KNOWN_ELEMENT_TYPES.add(Artifact_28);
+ KNOWN_ELEMENT_TYPES.add(Artifact_40);
+ KNOWN_ELEMENT_TYPES.add(Comment_54);
+ KNOWN_ELEMENT_TYPES.add(Constraint_56);
+ KNOWN_ELEMENT_TYPES.add(Link_4005);
+ KNOWN_ELEMENT_TYPES.add(CommentAnnotatedElement_4008);
+ KNOWN_ELEMENT_TYPES.add(ConstraintConstrainedElement_4009);
+ KNOWN_ELEMENT_TYPES.add(Deployment_4001);
+ KNOWN_ELEMENT_TYPES.add(Manifestation_4002);
+ KNOWN_ELEMENT_TYPES.add(Generalization_4003);
+ KNOWN_ELEMENT_TYPES.add(Dependency_4004);
+ KNOWN_ELEMENT_TYPES.add(Dependency_4010);
+ }
+
+ boolean result = KNOWN_ELEMENT_TYPES.contains(elementType);
+
+ if (!result) {
+ IElementType[] supertypes = elementType.getAllSuperTypes();
+ for (int i = 0; !result && (i < supertypes.length); i++) {
+ result = KNOWN_ELEMENT_TYPES.contains(supertypes[i]);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static IElementType getElementType(int visualID) {
+ switch (visualID) {
+ case DeploymentDiagramEditPart.VISUAL_ID:
+ return Package_1000;
+ case DependencyNodeEditPart.VISUAL_ID:
+ return Dependency_2011;
+ case ModelEditPart.VISUAL_ID:
+ return Model_2010;
+ case PackageEditPart.VISUAL_ID:
+ return Package_2009;
+ case ConstraintEditPart.VISUAL_ID:
+ return Constraint_2005;
+ case CommentEditPart.VISUAL_ID:
+ return Comment_2001;
+ case ExecutionEnvironmentEditPart.VISUAL_ID:
+ return ExecutionEnvironment_2002;
+ case DeviceEditPart.VISUAL_ID:
+ return Device_2003;
+ case ArtifactEditPart.VISUAL_ID:
+ return Artifact_2006;
+ case NodeEditPart.VISUAL_ID:
+ return Node_2008;
+ case DefaultNamedElementEditPart.VISUAL_ID:
+ return NamedElement_2012;
+ case ModelEditPartCN.VISUAL_ID:
+ return Model_49;
+ case PackageEditPartCN.VISUAL_ID:
+ return Package_36;
+ case DeviceEditPartCN.VISUAL_ID:
+ return Device_16;
+ case NestedDeviceEditPartCN.VISUAL_ID:
+ return Device_44;
+ case ExecutionEnvironmentEditPartCN.VISUAL_ID:
+ return ExecutionEnvironment_21;
+ case NestedExecutionEnvironmentEditPartCN.VISUAL_ID:
+ return ExecutionEnvironment_46;
+ case NodeEditPartCN.VISUAL_ID:
+ return Node_23;
+ case NestedNodeEditPartCN.VISUAL_ID:
+ return Node_42;
+ case ArtifactEditPartCN.VISUAL_ID:
+ return Artifact_25;
+ case ArtifactEditPartACN.VISUAL_ID:
+ return Artifact_28;
+ case NestedArtifactNodeEditPartCN.VISUAL_ID:
+ return Artifact_40;
+ case CommentEditPartCN.VISUAL_ID:
+ return Comment_54;
+ case ConstraintEditPartCN.VISUAL_ID:
+ return Constraint_56;
+ case LinkDescriptorEditPart.VISUAL_ID:
+ return Link_4005;
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return CommentAnnotatedElement_4008;
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return ConstraintConstrainedElement_4009;
+ case DeploymentEditPart.VISUAL_ID:
+ return Deployment_4001;
+ case ManifestationEditPart.VISUAL_ID:
+ return Manifestation_4002;
+ case GeneralizationEditPart.VISUAL_ID:
+ return Generalization_4003;
+ case DependencyEditPart.VISUAL_ID:
+ return Dependency_4004;
+ case DependencyBranchEditPart.VISUAL_ID:
+ return Dependency_4010;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public static final DiagramElementTypes TYPED_INSTANCE = new DiagramElementTypes(elementTypeImages) {
+
+ /**
+ * @generated
+ */
+ @Override
+ public boolean isKnownElementType(IElementType elementType) {
+ return org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes.isKnownElementType(elementType);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public IElementType getElementTypeForVisualId(int visualID) {
+ return org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes.getElementType(visualID);
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public ENamedElement getDefiningNamedElement(IAdaptable elementTypeAdapter) {
+ return org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes.getElement(elementTypeAdapter);
+ }
+ };
+
+ /**
+ * @generated
+ */
+ public static boolean isKindOf(IElementType subtype, IElementType supertype) {
+ boolean result = subtype == supertype;
+
+ if (!result) {
+ IElementType[] supertypes = subtype.getAllSuperTypes();
+ for (int i = 0; !result && (i < supertypes.length); i++) {
+ result = supertype == supertypes[i];
+ }
+ }
+
+ return result;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLIconProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLIconProvider.java
index 619c6651554..6b54adddbda 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLIconProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLIconProvider.java
@@ -1,28 +1,28 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.providers;
-
-import org.eclipse.gmf.runtime.common.ui.services.icon.IIconProvider;
-import org.eclipse.gmf.tooling.runtime.providers.DefaultElementTypeIconProvider;
-
-/**
- * @generated
- */
-public class UMLIconProvider extends DefaultElementTypeIconProvider implements IIconProvider {
-
- /**
- * @generated
- */
- public UMLIconProvider() {
- super(UMLElementTypes.TYPED_INSTANCE);
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.providers;
+
+import org.eclipse.gmf.runtime.common.ui.services.icon.IIconProvider;
+import org.eclipse.gmf.tooling.runtime.providers.DefaultElementTypeIconProvider;
+
+/**
+ * @generated
+ */
+public class UMLIconProvider extends DefaultElementTypeIconProvider implements IIconProvider {
+
+ /**
+ * @generated
+ */
+ public UMLIconProvider() {
+ super(UMLElementTypes.TYPED_INSTANCE);
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLMarkerNavigationProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLMarkerNavigationProvider.java
index c5176527e08..e81a751248b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLMarkerNavigationProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLMarkerNavigationProvider.java
@@ -1,96 +1,96 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.providers;
-
-import java.util.Arrays;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
-import org.eclipse.gmf.runtime.emf.ui.providers.marker.AbstractModelMarkerNavigationProvider;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorUtil;
-
-/**
- * @generated
- */
-public class UMLMarkerNavigationProvider extends AbstractModelMarkerNavigationProvider {
-
- /**
- * @generated
- */
- public static final String MARKER_TYPE = UMLDiagramEditorPlugin.ID + ".diagnostic"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- @Override
- 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 }));
- }
- }
-
- /**
- * @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
- */
- 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.core.resources.IMarker.ELEMENT_ID, elementId);
- int markerSeverity = IMarker.SEVERITY_INFO;
- if (statusSeverity == IStatus.WARNING) {
- markerSeverity = IMarker.SEVERITY_WARNING;
- } else if (statusSeverity == IStatus.ERROR ||
- statusSeverity == IStatus.CANCEL) {
- markerSeverity = IMarker.SEVERITY_ERROR;
- }
- marker.setAttribute(IMarker.SEVERITY, markerSeverity);
- } catch (CoreException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Failed to create validation marker", e); //$NON-NLS-1$
- }
- return marker;
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.providers;
+
+import java.util.Arrays;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
+import org.eclipse.gmf.runtime.emf.ui.providers.marker.AbstractModelMarkerNavigationProvider;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorUtil;
+
+/**
+ * @generated
+ */
+public class UMLMarkerNavigationProvider extends AbstractModelMarkerNavigationProvider {
+
+ /**
+ * @generated
+ */
+ public static final String MARKER_TYPE = UMLDiagramEditorPlugin.ID + ".diagnostic"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ @Override
+ 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 }));
+ }
+ }
+
+ /**
+ * @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
+ */
+ 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.core.resources.IMarker.ELEMENT_ID, elementId);
+ int markerSeverity = IMarker.SEVERITY_INFO;
+ if (statusSeverity == IStatus.WARNING) {
+ markerSeverity = IMarker.SEVERITY_WARNING;
+ } else if (statusSeverity == IStatus.ERROR || statusSeverity == IStatus.CANCEL) {
+ markerSeverity = IMarker.SEVERITY_ERROR;
+ }
+ marker.setAttribute(IMarker.SEVERITY, markerSeverity);
+ } catch (CoreException e) {
+ UMLDiagramEditorPlugin.getInstance().logError(
+ "Failed to create validation marker", e); //$NON-NLS-1$
+ }
+ return marker;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLParserProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLParserProvider.java
index cddc71c33a5..5e2e76efa91 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLParserProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLParserProvider.java
@@ -1,888 +1,859 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.providers;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
-import org.eclipse.gmf.runtime.common.core.service.IOperation;
-import org.eclipse.gmf.runtime.common.ui.services.parser.GetParserOperation;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserProvider;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.parser.CommentParser;
-import org.eclipse.papyrus.uml.diagram.common.parser.ConstraintParser;
-import org.eclipse.papyrus.uml.diagram.common.parser.stereotype.AppliedStereotypeParser;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartACN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPartACN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentBodyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentBodyEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintSpecificationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintSpecificationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DefaultNamedElementNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.MultiDependencyLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedArtifactNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedDeviceNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedExecutionEnvironmentNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedNodeNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.parsers.MessageFormatParser;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class UMLParserProvider extends AbstractProvider implements IParserProvider {
-
- /**
- * @generated
- */
- private IParser dependencyName_7Parser;
-
- /**
- * @generated
- */
- private IParser getDependencyName_7Parser() {
- if (dependencyName_7Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- dependencyName_7Parser = parser;
- }
- return dependencyName_7Parser;
- }
-
- /**
- * @generated
- */
- private IParser modelName_48Parser;
-
- /**
- * @generated
- */
- private IParser getModelName_48Parser() {
- if (modelName_48Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- modelName_48Parser = parser;
- }
- return modelName_48Parser;
- }
-
- /**
- * @generated
- */
- private IParser packageName_35Parser;
-
- /**
- * @generated
- */
- private IParser getPackageName_35Parser() {
- if (packageName_35Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- packageName_35Parser = parser;
- }
- return packageName_35Parser;
- }
-
- /**
- * @generated
- */
- private IParser constraintName_2Parser;
-
- /**
- * @generated
- */
- private IParser getConstraintName_2Parser() {
- if (constraintName_2Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- constraintName_2Parser = parser;
- }
- return constraintName_2Parser;
- }
-
- /**
- * @generated
- */
- private ConstraintParser constraintSpecification_3Parser;
-
- /**
- * @generated
- */
- private IParser getConstraintSpecification_3Parser() {
- if (constraintSpecification_3Parser == null) {
- constraintSpecification_3Parser = new ConstraintParser();
- }
- return constraintSpecification_3Parser;
- }
-
- /**
- * @generated
- */
- private CommentParser commentBody_1Parser;
-
- /**
- * @generated
- */
- private IParser getCommentBody_1Parser() {
- if (commentBody_1Parser == null) {
- commentBody_1Parser = new CommentParser();
- }
- return commentBody_1Parser;
- }
-
- /**
- * @generated
- */
- private IParser executionEnvironmentName_5Parser;
-
- /**
- * @generated
- */
- private IParser getExecutionEnvironmentName_5Parser() {
- if (executionEnvironmentName_5Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- executionEnvironmentName_5Parser = parser;
- }
- return executionEnvironmentName_5Parser;
- }
-
- /**
- * @generated
- */
- private IParser deviceName_6Parser;
-
- /**
- * @generated
- */
- private IParser getDeviceName_6Parser() {
- if (deviceName_6Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- deviceName_6Parser = parser;
- }
- return deviceName_6Parser;
- }
-
- /**
- * @generated
- */
- private IParser artifactName_8Parser;
-
- /**
- * @generated
- */
- private IParser getArtifactName_8Parser() {
- if (artifactName_8Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- artifactName_8Parser = parser;
- }
- return artifactName_8Parser;
- }
-
- /**
- * @generated
- */
- private IParser artifactName_61Parser;
-
- /**
- * @generated
- */
- private IParser getArtifactName_61Parser() {
- if (artifactName_61Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- artifactName_61Parser = parser;
- }
- return artifactName_61Parser;
- }
-
- /**
- * @generated
- */
- private IParser nodeName_9Parser;
-
- /**
- * @generated
- */
- private IParser getNodeName_9Parser() {
- if (nodeName_9Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- nodeName_9Parser = parser;
- }
- return nodeName_9Parser;
- }
-
- /**
- * @generated
- */
- private IParser namedElementName_53Parser;
-
- /**
- * @generated
- */
- private IParser getNamedElementName_53Parser() {
- if (namedElementName_53Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- namedElementName_53Parser = parser;
- }
- return namedElementName_53Parser;
- }
-
- /**
- * @generated
- */
- private IParser modelName_50Parser;
-
- /**
- * @generated
- */
- private IParser getModelName_50Parser() {
- if (modelName_50Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- modelName_50Parser = parser;
- }
- return modelName_50Parser;
- }
-
- /**
- * @generated
- */
- private IParser packageName_37Parser;
-
- /**
- * @generated
- */
- private IParser getPackageName_37Parser() {
- if (packageName_37Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- packageName_37Parser = parser;
- }
- return packageName_37Parser;
- }
-
- /**
- * @generated
- */
- private IParser deviceName_20Parser;
-
- /**
- * @generated
- */
- private IParser getDeviceName_20Parser() {
- if (deviceName_20Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- deviceName_20Parser = parser;
- }
- return deviceName_20Parser;
- }
-
- /**
- * @generated
- */
- private IParser deviceName_45Parser;
-
- /**
- * @generated
- */
- private IParser getDeviceName_45Parser() {
- if (deviceName_45Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- deviceName_45Parser = parser;
- }
- return deviceName_45Parser;
- }
-
- /**
- * @generated
- */
- private IParser executionEnvironmentName_22Parser;
-
- /**
- * @generated
- */
- private IParser getExecutionEnvironmentName_22Parser() {
- if (executionEnvironmentName_22Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- executionEnvironmentName_22Parser = parser;
- }
- return executionEnvironmentName_22Parser;
- }
-
- /**
- * @generated
- */
- private IParser executionEnvironmentName_47Parser;
-
- /**
- * @generated
- */
- private IParser getExecutionEnvironmentName_47Parser() {
- if (executionEnvironmentName_47Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- executionEnvironmentName_47Parser = parser;
- }
- return executionEnvironmentName_47Parser;
- }
-
- /**
- * @generated
- */
- private IParser nodeName_24Parser;
-
- /**
- * @generated
- */
- private IParser getNodeName_24Parser() {
- if (nodeName_24Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- nodeName_24Parser = parser;
- }
- return nodeName_24Parser;
- }
-
- /**
- * @generated
- */
- private IParser nodeName_43Parser;
-
- /**
- * @generated
- */
- private IParser getNodeName_43Parser() {
- if (nodeName_43Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- nodeName_43Parser = parser;
- }
- return nodeName_43Parser;
- }
-
- /**
- * @generated
- */
- private IParser artifactName_27Parser;
-
- /**
- * @generated
- */
- private IParser getArtifactName_27Parser() {
- if (artifactName_27Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- artifactName_27Parser = parser;
- }
- return artifactName_27Parser;
- }
-
- /**
- * @generated
- */
- private IParser artifactName_59Parser;
-
- /**
- * @generated
- */
- private IParser getArtifactName_59Parser() {
- if (artifactName_59Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- artifactName_59Parser = parser;
- }
- return artifactName_59Parser;
- }
-
- /**
- * @generated
- */
- private IParser artifactName_29Parser;
-
- /**
- * @generated
- */
- private IParser getArtifactName_29Parser() {
- if (artifactName_29Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- artifactName_29Parser = parser;
- }
- return artifactName_29Parser;
- }
-
- /**
- * @generated
- */
- private IParser artifactName_60Parser;
-
- /**
- * @generated
- */
- private IParser getArtifactName_60Parser() {
- if (artifactName_60Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- artifactName_60Parser = parser;
- }
- return artifactName_60Parser;
- }
-
- /**
- * @generated
- */
- private IParser artifactName_41Parser;
-
- /**
- * @generated
- */
- private IParser getArtifactName_41Parser() {
- if (artifactName_41Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- artifactName_41Parser = parser;
- }
- return artifactName_41Parser;
- }
-
- /**
- * @generated
- */
- private CommentParser commentBody_55Parser;
-
- /**
- * @generated
- */
- private IParser getCommentBody_55Parser() {
- if (commentBody_55Parser == null) {
- commentBody_55Parser = new CommentParser();
- }
- return commentBody_55Parser;
- }
-
- /**
- * @generated
- */
- private IParser constraintName_57Parser;
-
- /**
- * @generated
- */
- private IParser getConstraintName_57Parser() {
- if (constraintName_57Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- constraintName_57Parser = parser;
- }
- return constraintName_57Parser;
- }
-
- /**
- * @generated
- */
- private ConstraintParser constraintSpecification_58Parser;
-
- /**
- * @generated
- */
- private IParser getConstraintSpecification_58Parser() {
- if (constraintSpecification_58Parser == null) {
- constraintSpecification_58Parser = new ConstraintParser();
- }
- return constraintSpecification_58Parser;
- }
-
- /**
- * @generated
- */
- private IParser deploymentName_13Parser;
-
- /**
- * @generated
- */
- private IParser getDeploymentName_13Parser() {
- if (deploymentName_13Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- deploymentName_13Parser = parser;
- }
- return deploymentName_13Parser;
- }
-
- /**
- * @generated
- */
- private AppliedStereotypeParser deploymentName_14Parser;
-
- /**
- * @generated
- */
- private IParser getDeploymentName_14Parser() {
- if (deploymentName_14Parser == null) {
- deploymentName_14Parser = new AppliedStereotypeParser();
- }
- return deploymentName_14Parser;
- }
-
- /**
- * @generated
- */
- private IParser manifestationName_10Parser;
-
- /**
- * @generated
- */
- private IParser getManifestationName_10Parser() {
- if (manifestationName_10Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- manifestationName_10Parser = parser;
- }
- return manifestationName_10Parser;
- }
-
- /**
- * @generated
- */
- private AppliedStereotypeParser manifestationName_11Parser;
-
- /**
- * @generated
- */
- private IParser getManifestationName_11Parser() {
- if (manifestationName_11Parser == null) {
- manifestationName_11Parser = new AppliedStereotypeParser();
- }
- return manifestationName_11Parser;
- }
-
- /**
- * @generated
- */
- private AppliedStereotypeParser generalizationIsSubstitutable_4Parser;
-
- /**
- * @generated
- */
- private IParser getGeneralizationIsSubstitutable_4Parser() {
- if (generalizationIsSubstitutable_4Parser == null) {
- generalizationIsSubstitutable_4Parser = new AppliedStereotypeParser();
- }
- return generalizationIsSubstitutable_4Parser;
- }
-
- /**
- * @generated
- */
- private IParser dependencyName_12Parser;
-
- /**
- * @generated
- */
- private IParser getDependencyName_12Parser() {
- if (dependencyName_12Parser == null) {
- EAttribute[] features = new EAttribute[] {
- UMLPackage.eINSTANCE.getNamedElement_Name()
- };
- MessageFormatParser parser = new MessageFormatParser(features);
- dependencyName_12Parser = parser;
- }
- return dependencyName_12Parser;
- }
-
- /**
- * @generated
- */
- private AppliedStereotypeParser dependencyName_15Parser;
-
- /**
- * @generated
- */
- private IParser getDependencyName_15Parser() {
- if (dependencyName_15Parser == null) {
- dependencyName_15Parser = new AppliedStereotypeParser();
- }
- return dependencyName_15Parser;
- }
-
- /**
- * @generated
- */
- protected IParser getParser(int visualID) {
- switch (visualID) {
- case MultiDependencyLabelEditPart.VISUAL_ID:
- return getDependencyName_7Parser();
-
- case ModelNameEditPart.VISUAL_ID:
- return getModelName_48Parser();
-
- case PackageNameEditPart.VISUAL_ID:
- return getPackageName_35Parser();
-
- case ConstraintNameEditPart.VISUAL_ID:
- return getConstraintName_2Parser();
- case ConstraintSpecificationEditPart.VISUAL_ID:
- return getConstraintSpecification_3Parser();
-
- case CommentBodyEditPart.VISUAL_ID:
- return getCommentBody_1Parser();
-
- case ExecutionEnvironmentNameEditPart.VISUAL_ID:
- return getExecutionEnvironmentName_5Parser();
-
- case DeviceNameEditPart.VISUAL_ID:
- return getDeviceName_6Parser();
-
- case ArtifactNameEditPart.VISUAL_ID:
- return getArtifactName_8Parser();
- case ArtifactFloatingLabelEditPart.VISUAL_ID:
- return getArtifactName_61Parser();
-
- case NodeNameEditPart.VISUAL_ID:
- return getNodeName_9Parser();
-
- case DefaultNamedElementNameEditPart.VISUAL_ID:
- return getNamedElementName_53Parser();
-
- case ModelNameEditPartCN.VISUAL_ID:
- return getModelName_50Parser();
-
- case PackageNameEditPartCN.VISUAL_ID:
- return getPackageName_37Parser();
-
- case DeviceNameEditPartCN.VISUAL_ID:
- return getDeviceName_20Parser();
-
- case NestedDeviceNameEditPartCN.VISUAL_ID:
- return getDeviceName_45Parser();
-
- case ExecutionEnvironmentNameEditPartCN.VISUAL_ID:
- return getExecutionEnvironmentName_22Parser();
-
- case NestedExecutionEnvironmentNameEditPartCN.VISUAL_ID:
- return getExecutionEnvironmentName_47Parser();
-
- case NodeNameEditPartCN.VISUAL_ID:
- return getNodeName_24Parser();
-
- case NestedNodeNameEditPart.VISUAL_ID:
- return getNodeName_43Parser();
-
- case ArtifactNameEditPartCN.VISUAL_ID:
- return getArtifactName_27Parser();
- case ArtifactFloatingLabelEditPartCN.VISUAL_ID:
- return getArtifactName_59Parser();
-
- case ArtifactNameEditPartACN.VISUAL_ID:
- return getArtifactName_29Parser();
- case ArtifactFloatingLabelEditPartACN.VISUAL_ID:
- return getArtifactName_60Parser();
-
- case NestedArtifactNameEditPart.VISUAL_ID:
- return getArtifactName_41Parser();
-
- case CommentBodyEditPartCN.VISUAL_ID:
- return getCommentBody_55Parser();
-
- case ConstraintNameEditPartCN.VISUAL_ID:
- return getConstraintName_57Parser();
- case ConstraintSpecificationEditPartCN.VISUAL_ID:
- return getConstraintSpecification_58Parser();
-
-
-
-
- case DeploymentNameEditPart.VISUAL_ID:
- return getDeploymentName_13Parser();
- case DeploymentAppliedStereotypeEditPart.VISUAL_ID:
- return getDeploymentName_14Parser();
-
- case ManifestationNameEditPart.VISUAL_ID:
- return getManifestationName_10Parser();
- case ManifestationAppliedStereotypeEditPart.VISUAL_ID:
- return getManifestationName_11Parser();
-
- case GeneralizationAppliedStereotypeEditPart.VISUAL_ID:
- return getGeneralizationIsSubstitutable_4Parser();
-
- case DependencyNameEditPart.VISUAL_ID:
- return getDependencyName_12Parser();
- case DependencyAppliedStereotypeEditPart.VISUAL_ID:
- return getDependencyName_15Parser();
-
-
- }
- return null;
- }
-
- /**
- * 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
- */
- @Override
- 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
- */
- @Override
- 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;
- }
-
- /**
- * @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
- */
- @Override
- public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
- if (IElementType.class.equals(adapter)) {
- return elementType;
- }
- return super.getAdapter(adapter);
- }
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.providers;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.common.ui.services.parser.GetParserOperation;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserProvider;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.parser.CommentParser;
+import org.eclipse.papyrus.uml.diagram.common.parser.ConstraintParser;
+import org.eclipse.papyrus.uml.diagram.common.parser.stereotype.AppliedStereotypeParser;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartACN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPartACN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentBodyEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentBodyEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintSpecificationEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintSpecificationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DefaultNamedElementNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.MultiDependencyLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedArtifactNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedDeviceNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedExecutionEnvironmentNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedNodeNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.parsers.MessageFormatParser;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class UMLParserProvider extends AbstractProvider implements IParserProvider {
+
+ /**
+ * @generated
+ */
+ private IParser dependencyName_7Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getDependencyName_7Parser() {
+ if (dependencyName_7Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ dependencyName_7Parser = parser;
+ }
+ return dependencyName_7Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser modelName_48Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getModelName_48Parser() {
+ if (modelName_48Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ modelName_48Parser = parser;
+ }
+ return modelName_48Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser packageName_35Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getPackageName_35Parser() {
+ if (packageName_35Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ packageName_35Parser = parser;
+ }
+ return packageName_35Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser constraintName_2Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getConstraintName_2Parser() {
+ if (constraintName_2Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ constraintName_2Parser = parser;
+ }
+ return constraintName_2Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private ConstraintParser constraintSpecification_3Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getConstraintSpecification_3Parser() {
+ if (constraintSpecification_3Parser == null) {
+ constraintSpecification_3Parser = new ConstraintParser();
+ }
+ return constraintSpecification_3Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private CommentParser commentBody_1Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getCommentBody_1Parser() {
+ if (commentBody_1Parser == null) {
+ commentBody_1Parser = new CommentParser();
+ }
+ return commentBody_1Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser executionEnvironmentName_5Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getExecutionEnvironmentName_5Parser() {
+ if (executionEnvironmentName_5Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ executionEnvironmentName_5Parser = parser;
+ }
+ return executionEnvironmentName_5Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser deviceName_6Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getDeviceName_6Parser() {
+ if (deviceName_6Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ deviceName_6Parser = parser;
+ }
+ return deviceName_6Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser artifactName_8Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getArtifactName_8Parser() {
+ if (artifactName_8Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ artifactName_8Parser = parser;
+ }
+ return artifactName_8Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser artifactName_61Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getArtifactName_61Parser() {
+ if (artifactName_61Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ artifactName_61Parser = parser;
+ }
+ return artifactName_61Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser nodeName_9Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getNodeName_9Parser() {
+ if (nodeName_9Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ nodeName_9Parser = parser;
+ }
+ return nodeName_9Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser namedElementName_53Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getNamedElementName_53Parser() {
+ if (namedElementName_53Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ namedElementName_53Parser = parser;
+ }
+ return namedElementName_53Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser modelName_50Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getModelName_50Parser() {
+ if (modelName_50Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ modelName_50Parser = parser;
+ }
+ return modelName_50Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser packageName_37Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getPackageName_37Parser() {
+ if (packageName_37Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ packageName_37Parser = parser;
+ }
+ return packageName_37Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser deviceName_20Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getDeviceName_20Parser() {
+ if (deviceName_20Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ deviceName_20Parser = parser;
+ }
+ return deviceName_20Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser deviceName_45Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getDeviceName_45Parser() {
+ if (deviceName_45Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ deviceName_45Parser = parser;
+ }
+ return deviceName_45Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser executionEnvironmentName_22Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getExecutionEnvironmentName_22Parser() {
+ if (executionEnvironmentName_22Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ executionEnvironmentName_22Parser = parser;
+ }
+ return executionEnvironmentName_22Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser executionEnvironmentName_47Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getExecutionEnvironmentName_47Parser() {
+ if (executionEnvironmentName_47Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ executionEnvironmentName_47Parser = parser;
+ }
+ return executionEnvironmentName_47Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser nodeName_24Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getNodeName_24Parser() {
+ if (nodeName_24Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ nodeName_24Parser = parser;
+ }
+ return nodeName_24Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser nodeName_43Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getNodeName_43Parser() {
+ if (nodeName_43Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ nodeName_43Parser = parser;
+ }
+ return nodeName_43Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser artifactName_27Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getArtifactName_27Parser() {
+ if (artifactName_27Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ artifactName_27Parser = parser;
+ }
+ return artifactName_27Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser artifactName_59Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getArtifactName_59Parser() {
+ if (artifactName_59Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ artifactName_59Parser = parser;
+ }
+ return artifactName_59Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser artifactName_29Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getArtifactName_29Parser() {
+ if (artifactName_29Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ artifactName_29Parser = parser;
+ }
+ return artifactName_29Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser artifactName_60Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getArtifactName_60Parser() {
+ if (artifactName_60Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ artifactName_60Parser = parser;
+ }
+ return artifactName_60Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser artifactName_41Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getArtifactName_41Parser() {
+ if (artifactName_41Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ artifactName_41Parser = parser;
+ }
+ return artifactName_41Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private CommentParser commentBody_55Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getCommentBody_55Parser() {
+ if (commentBody_55Parser == null) {
+ commentBody_55Parser = new CommentParser();
+ }
+ return commentBody_55Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser constraintName_57Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getConstraintName_57Parser() {
+ if (constraintName_57Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ constraintName_57Parser = parser;
+ }
+ return constraintName_57Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private ConstraintParser constraintSpecification_58Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getConstraintSpecification_58Parser() {
+ if (constraintSpecification_58Parser == null) {
+ constraintSpecification_58Parser = new ConstraintParser();
+ }
+ return constraintSpecification_58Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser deploymentName_13Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getDeploymentName_13Parser() {
+ if (deploymentName_13Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ deploymentName_13Parser = parser;
+ }
+ return deploymentName_13Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private AppliedStereotypeParser deploymentName_14Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getDeploymentName_14Parser() {
+ if (deploymentName_14Parser == null) {
+ deploymentName_14Parser = new AppliedStereotypeParser();
+ }
+ return deploymentName_14Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser manifestationName_10Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getManifestationName_10Parser() {
+ if (manifestationName_10Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ manifestationName_10Parser = parser;
+ }
+ return manifestationName_10Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private AppliedStereotypeParser manifestationName_11Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getManifestationName_11Parser() {
+ if (manifestationName_11Parser == null) {
+ manifestationName_11Parser = new AppliedStereotypeParser();
+ }
+ return manifestationName_11Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private AppliedStereotypeParser generalizationIsSubstitutable_4Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getGeneralizationIsSubstitutable_4Parser() {
+ if (generalizationIsSubstitutable_4Parser == null) {
+ generalizationIsSubstitutable_4Parser = new AppliedStereotypeParser();
+ }
+ return generalizationIsSubstitutable_4Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser dependencyName_12Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getDependencyName_12Parser() {
+ if (dependencyName_12Parser == null) {
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name() };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ dependencyName_12Parser = parser;
+ }
+ return dependencyName_12Parser;
+ }
+
+ /**
+ * @generated
+ */
+ private AppliedStereotypeParser dependencyName_15Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getDependencyName_15Parser() {
+ if (dependencyName_15Parser == null) {
+ dependencyName_15Parser = new AppliedStereotypeParser();
+ }
+ return dependencyName_15Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser getParser(int visualID) {
+ switch (visualID) {
+ case MultiDependencyLabelEditPart.VISUAL_ID:
+ return getDependencyName_7Parser();
+
+ case ModelNameEditPart.VISUAL_ID:
+ return getModelName_48Parser();
+
+ case PackageNameEditPart.VISUAL_ID:
+ return getPackageName_35Parser();
+
+ case ConstraintNameEditPart.VISUAL_ID:
+ return getConstraintName_2Parser();
+ case ConstraintSpecificationEditPart.VISUAL_ID:
+ return getConstraintSpecification_3Parser();
+
+ case CommentBodyEditPart.VISUAL_ID:
+ return getCommentBody_1Parser();
+
+ case ExecutionEnvironmentNameEditPart.VISUAL_ID:
+ return getExecutionEnvironmentName_5Parser();
+
+ case DeviceNameEditPart.VISUAL_ID:
+ return getDeviceName_6Parser();
+
+ case ArtifactNameEditPart.VISUAL_ID:
+ return getArtifactName_8Parser();
+ case ArtifactFloatingLabelEditPart.VISUAL_ID:
+ return getArtifactName_61Parser();
+
+ case NodeNameEditPart.VISUAL_ID:
+ return getNodeName_9Parser();
+
+ case DefaultNamedElementNameEditPart.VISUAL_ID:
+ return getNamedElementName_53Parser();
+
+ case ModelNameEditPartCN.VISUAL_ID:
+ return getModelName_50Parser();
+
+ case PackageNameEditPartCN.VISUAL_ID:
+ return getPackageName_37Parser();
+
+ case DeviceNameEditPartCN.VISUAL_ID:
+ return getDeviceName_20Parser();
+
+ case NestedDeviceNameEditPartCN.VISUAL_ID:
+ return getDeviceName_45Parser();
+
+ case ExecutionEnvironmentNameEditPartCN.VISUAL_ID:
+ return getExecutionEnvironmentName_22Parser();
+
+ case NestedExecutionEnvironmentNameEditPartCN.VISUAL_ID:
+ return getExecutionEnvironmentName_47Parser();
+
+ case NodeNameEditPartCN.VISUAL_ID:
+ return getNodeName_24Parser();
+
+ case NestedNodeNameEditPart.VISUAL_ID:
+ return getNodeName_43Parser();
+
+ case ArtifactNameEditPartCN.VISUAL_ID:
+ return getArtifactName_27Parser();
+ case ArtifactFloatingLabelEditPartCN.VISUAL_ID:
+ return getArtifactName_59Parser();
+
+ case ArtifactNameEditPartACN.VISUAL_ID:
+ return getArtifactName_29Parser();
+ case ArtifactFloatingLabelEditPartACN.VISUAL_ID:
+ return getArtifactName_60Parser();
+
+ case NestedArtifactNameEditPart.VISUAL_ID:
+ return getArtifactName_41Parser();
+
+ case CommentBodyEditPartCN.VISUAL_ID:
+ return getCommentBody_55Parser();
+
+ case ConstraintNameEditPartCN.VISUAL_ID:
+ return getConstraintName_57Parser();
+ case ConstraintSpecificationEditPartCN.VISUAL_ID:
+ return getConstraintSpecification_58Parser();
+
+
+
+
+ case DeploymentNameEditPart.VISUAL_ID:
+ return getDeploymentName_13Parser();
+ case DeploymentAppliedStereotypeEditPart.VISUAL_ID:
+ return getDeploymentName_14Parser();
+
+ case ManifestationNameEditPart.VISUAL_ID:
+ return getManifestationName_10Parser();
+ case ManifestationAppliedStereotypeEditPart.VISUAL_ID:
+ return getManifestationName_11Parser();
+
+ case GeneralizationAppliedStereotypeEditPart.VISUAL_ID:
+ return getGeneralizationIsSubstitutable_4Parser();
+
+ case DependencyNameEditPart.VISUAL_ID:
+ return getDependencyName_12Parser();
+ case DependencyAppliedStereotypeEditPart.VISUAL_ID:
+ return getDependencyName_15Parser();
+
+
+ }
+ return null;
+ }
+
+ /**
+ * 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
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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;
+ }
+
+ /**
+ * @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
+ */
+ @Override
+ public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
+ if (IElementType.class.equals(adapter)) {
+ return elementType;
+ }
+ return super.getAdapter(adapter);
+ }
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLValidationDecoratorProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLValidationDecoratorProvider.java
index b048b60a8f8..05bcb931d28 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLValidationDecoratorProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLValidationDecoratorProvider.java
@@ -1,74 +1,72 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.providers;
-
-import org.eclipse.gef.EditDomain;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.editparts.AbstractConnectionEditPart;
-import org.eclipse.gmf.runtime.common.core.service.IOperation;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditDomain;
-import org.eclipse.gmf.runtime.diagram.ui.services.decorator.CreateDecoratorsOperation;
-import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorProvider;
-import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget;
-import org.eclipse.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.providers.ValidationDecoratorProvider;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditor;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-
-/**
- * @generated
- */
-public class UMLValidationDecoratorProvider extends ValidationDecoratorProvider implements IDecoratorProvider {
-
- /**
- * @generated
- */
- @Override
- 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
- */
- @Override
- 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 && DeploymentDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view));
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.providers;
+
+import org.eclipse.gef.EditDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.editparts.AbstractConnectionEditPart;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditDomain;
+import org.eclipse.gmf.runtime.diagram.ui.services.decorator.CreateDecoratorsOperation;
+import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorProvider;
+import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.providers.ValidationDecoratorProvider;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditor;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class UMLValidationDecoratorProvider extends ValidationDecoratorProvider implements IDecoratorProvider {
+
+ /**
+ * @generated
+ */
+ @Override
+ 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
+ */
+ @Override
+ 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 && DeploymentDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view));
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLValidationProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLValidationProvider.java
index 7709f8754f8..33b4e5bed9c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLValidationProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLValidationProvider.java
@@ -1,76 +1,76 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.providers;
-
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-
-/**
- * @generated
- */
-public class UMLValidationProvider {
-
- /**
- * @generated
- */
- private static boolean constraintsActive = false;
-
- /**
- * @generated
- */
- public static boolean shouldConstraintsBePrivate() {
- return false;
- }
-
- /**
- * @generated
- */
- public static void runWithConstraints(TransactionalEditingDomain editingDomain, Runnable operation) {
- final Runnable op = operation;
- Runnable task = new Runnable() {
- @Override
- 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
- */
- static boolean isInDefaultEditorContext(Object object) {
- if (shouldConstraintsBePrivate() && !constraintsActive) {
- return false;
- }
- if (object instanceof View) {
- return constraintsActive && DeploymentDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID((View) object));
- }
- return true;
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.providers;
+
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class UMLValidationProvider {
+
+ /**
+ * @generated
+ */
+ private static boolean constraintsActive = false;
+
+ /**
+ * @generated
+ */
+ public static boolean shouldConstraintsBePrivate() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public static void runWithConstraints(TransactionalEditingDomain editingDomain, Runnable operation) {
+ final Runnable op = operation;
+ Runnable task = new Runnable() {
+ @Override
+ 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
+ */
+ static boolean isInDefaultEditorContext(Object object) {
+ if (shouldConstraintsBePrivate() && !constraintsActive) {
+ return false;
+ }
+ if (object instanceof View) {
+ return constraintsActive && DeploymentDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID((View) object));
+ }
+ return true;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLViewProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLViewProvider.java
index f3168d566a2..e9c229135f8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLViewProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLViewProvider.java
@@ -1,1276 +1,1264 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.providers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EcoreFactory;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
-import org.eclipse.gmf.runtime.common.core.service.IOperation;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.diagram.core.providers.IViewProvider;
-import org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation;
-import org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation;
-import org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation;
-import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation;
-import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewOperation;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
-import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
-import org.eclipse.gmf.runtime.notation.Connector;
-import org.eclipse.gmf.runtime.notation.DecorationNode;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.FillStyle;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.Location;
-import org.eclipse.gmf.runtime.notation.MeasurementUnit;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.RelativeBendpoints;
-import org.eclipse.gmf.runtime.notation.Shape;
-import org.eclipse.gmf.runtime.notation.TitleStyle;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramVersioningUtils;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactCompositeCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactCompositeCompartmentEditPartACN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactCompositeCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPartACN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartACN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPartACN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentBodyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentBodyEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintSpecificationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintSpecificationEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DefaultNamedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DefaultNamedElementNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNodeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceCompositeCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceCompositeCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentCompositeCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentCompositeCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.LinkDescriptorEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelPackageableElementCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelPackageableElementCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.MultiDependencyLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedArtifactNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedArtifactNodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedDeviceEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedDeviceNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedExecutionEnvironmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedExecutionEnvironmentNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedNodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedNodeNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeCompositeCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeCompositeCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageNameEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageNameEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackagePackageableElementCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackagePackageableElementCompartmentEditPartCN;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.FontData;
-
-/**
- * @generated
- */
-public class UMLViewProvider extends AbstractProvider implements IViewProvider {
-
- /**
- * @generated
- */
- @Override
- 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 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;
- */
-
- // check Diagram Type should be the class diagram
- String modelID = UMLVisualIDRegistry.getModelID(op.getContainerView());
- if (!getDiagramProvidedId().equals(modelID)) {
- return false;
- }
-
- int visualID = UMLVisualIDRegistry.getVisualID(op.getSemanticHint());
- if (Node.class.isAssignableFrom(op.getViewKind())) {
- return UMLVisualIDRegistry.canCreateNode(op.getContainerView(), visualID);
- }
-
- return true;
- }
-
- /**
- * @generated
- */
- protected String getDiagramProvidedId() {
- /*
- * Indicates for which diagram this provider works for.
- * <p>
- * This method can be overloaded when diagram editor inherits from another one, but should never be <code>null</code>
- * </p>
- *
- * @return the unique identifier of the diagram for which views are provided.
- */
- return DeploymentDiagramEditPart.MODEL_ID;
- }
-
- /**
- * @generated
- */
- protected boolean provides(CreateDiagramViewOperation op) {
- return DeploymentDiagramEditPart.MODEL_ID.equals(op.getSemanticHint()) && UMLVisualIDRegistry.getDiagramVisualID(getSemanticElement(op.getSemanticAdapter())) != -1;
- }
-
- /**
- * @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 (elementType instanceof IExtendedHintedElementType) {
- if (domainElement != null) {
- if (!UMLVisualIDRegistry.checkNodeVisualID(op.getContainerView(), domainElement, visualID)) {
- return false;
- }
- }
- } else {
- 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 (!DeploymentDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(op.getContainerView()))) {
- return false; // foreign diagram
- }
- switch (visualID) {
- case DependencyNodeEditPart.VISUAL_ID:
- case ConstraintEditPart.VISUAL_ID:
- case CommentEditPart.VISUAL_ID:
- case ExecutionEnvironmentEditPart.VISUAL_ID:
- case DeviceEditPart.VISUAL_ID:
- case ArtifactEditPart.VISUAL_ID:
- case NodeEditPart.VISUAL_ID:
- case DefaultNamedElementEditPart.VISUAL_ID:
- case CommentEditPartCN.VISUAL_ID:
- case ConstraintEditPartCN.VISUAL_ID:
- case ModelEditPart.VISUAL_ID:
- case PackageEditPart.VISUAL_ID:
- case ModelEditPartCN.VISUAL_ID:
- case PackageEditPartCN.VISUAL_ID:
- case DeviceEditPartCN.VISUAL_ID:
- case NestedDeviceEditPartCN.VISUAL_ID:
- case ExecutionEnvironmentEditPartCN.VISUAL_ID:
- case NestedExecutionEnvironmentEditPartCN.VISUAL_ID:
- case NodeEditPartCN.VISUAL_ID:
- case NestedNodeEditPartCN.VISUAL_ID:
- case ArtifactEditPartCN.VISUAL_ID:
- case ArtifactEditPartACN.VISUAL_ID:
- case NestedArtifactNodeEditPartCN.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 DependencyNodeEditPart.VISUAL_ID == visualID || ModelEditPart.VISUAL_ID == visualID || PackageEditPart.VISUAL_ID == visualID || ConstraintEditPart.VISUAL_ID == visualID || CommentEditPart.VISUAL_ID == visualID
- || ExecutionEnvironmentEditPart.VISUAL_ID == visualID || DeviceEditPart.VISUAL_ID == visualID || ArtifactEditPart.VISUAL_ID == visualID || NodeEditPart.VISUAL_ID == visualID || DefaultNamedElementEditPart.VISUAL_ID == visualID
- || ModelEditPartCN.VISUAL_ID == visualID || PackageEditPartCN.VISUAL_ID == visualID || DeviceEditPartCN.VISUAL_ID == visualID || NestedDeviceEditPartCN.VISUAL_ID == visualID || ExecutionEnvironmentEditPartCN.VISUAL_ID == visualID
- || NestedExecutionEnvironmentEditPartCN.VISUAL_ID == visualID || NodeEditPartCN.VISUAL_ID == visualID || NestedNodeEditPartCN.VISUAL_ID == visualID || ArtifactEditPartCN.VISUAL_ID == visualID || ArtifactEditPartACN.VISUAL_ID == visualID
- || NestedArtifactNodeEditPartCN.VISUAL_ID == visualID || CommentEditPartCN.VISUAL_ID == visualID || ConstraintEditPartCN.VISUAL_ID == visualID;
-
-
- }
-
- /**
- * @generated
- */
- protected boolean provides(CreateEdgeViewOperation op) {
- IElementType elementType = getSemanticElementType(op.getSemanticAdapter());
- // RS: add code for extended types creation
- if (elementType instanceof IExtendedHintedElementType) {
- IElementType closestNonExtendedType = ElementTypeUtils.getClosestDiagramType(elementType);
- if (!UMLElementTypes.isKnownElementType(closestNonExtendedType) || (!(closestNonExtendedType instanceof IHintedType))) {
- return false; // foreign element type.
- }
- } else {
- if (!UMLElementTypes.isKnownElementType(elementType) || (!(elementType instanceof IHintedType))) {
- return false; // foreign element type
- }
- }
- // if (!org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes.isKnownElementType(elementType) || (!(elementType instanceof org.eclipse.gmf.runtime.emf.type.core.IHintedType))) {
- // return false; // foreign element type
- // }
- // END R.S.
- 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
- */
- @Override
- @SuppressWarnings("unchecked")
- public Diagram createDiagram(IAdaptable semanticAdapter, String diagramKind, PreferencesHint preferencesHint) {
- Diagram diagram = NotationFactory.eINSTANCE.createDiagram();
- DiagramVersioningUtils.stampCurrentVersion(diagram);
- diagram.getStyles().add(NotationFactory.eINSTANCE.createDiagramStyle());
- diagram.setType(DeploymentDiagramEditPart.MODEL_ID);
- diagram.setElement(getSemanticElement(semanticAdapter));
- diagram.setMeasurementUnit(MeasurementUnit.PIXEL_LITERAL);
- return diagram;
- }
-
- /**
- * @generated
- */
- @Override
- 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 DependencyNodeEditPart.VISUAL_ID:
- return createDependency_2011(domainElement, containerView, index, persisted, preferencesHint);
- case ModelEditPart.VISUAL_ID:
- return createModel_2010(domainElement, containerView, index, persisted, preferencesHint);
- case PackageEditPart.VISUAL_ID:
- return createPackage_2009(domainElement, containerView, index, persisted, preferencesHint);
- case ConstraintEditPart.VISUAL_ID:
- return createConstraint_2005(domainElement, containerView, index, persisted, preferencesHint);
- case CommentEditPart.VISUAL_ID:
- return createComment_2001(domainElement, containerView, index, persisted, preferencesHint);
- case ExecutionEnvironmentEditPart.VISUAL_ID:
- return createExecutionEnvironment_2002(domainElement, containerView, index, persisted, preferencesHint);
- case DeviceEditPart.VISUAL_ID:
- return createDevice_2003(domainElement, containerView, index, persisted, preferencesHint);
- case ArtifactEditPart.VISUAL_ID:
- return createArtifact_2006(domainElement, containerView, index, persisted, preferencesHint);
- case NodeEditPart.VISUAL_ID:
- return createNode_2008(domainElement, containerView, index, persisted, preferencesHint);
- case DefaultNamedElementEditPart.VISUAL_ID:
- return createNamedElement_2012(domainElement, containerView, index, persisted, preferencesHint);
- case ModelEditPartCN.VISUAL_ID:
- return createModel_49(domainElement, containerView, index, persisted, preferencesHint);
- case PackageEditPartCN.VISUAL_ID:
- return createPackage_36(domainElement, containerView, index, persisted, preferencesHint);
- case DeviceEditPartCN.VISUAL_ID:
- return createDevice_16(domainElement, containerView, index, persisted, preferencesHint);
- case NestedDeviceEditPartCN.VISUAL_ID:
- return createDevice_44(domainElement, containerView, index, persisted, preferencesHint);
- case ExecutionEnvironmentEditPartCN.VISUAL_ID:
- return createExecutionEnvironment_21(domainElement, containerView, index, persisted, preferencesHint);
- case NestedExecutionEnvironmentEditPartCN.VISUAL_ID:
- return createExecutionEnvironment_46(domainElement, containerView, index, persisted, preferencesHint);
- case NodeEditPartCN.VISUAL_ID:
- return createNode_23(domainElement, containerView, index, persisted, preferencesHint);
- case NestedNodeEditPartCN.VISUAL_ID:
- return createNode_42(domainElement, containerView, index, persisted, preferencesHint);
- case ArtifactEditPartCN.VISUAL_ID:
- return createArtifact_25(domainElement, containerView, index, persisted, preferencesHint);
- case ArtifactEditPartACN.VISUAL_ID:
- return createArtifact_28(domainElement, containerView, index, persisted, preferencesHint);
- case NestedArtifactNodeEditPartCN.VISUAL_ID:
- return createArtifact_40(domainElement, containerView, index, persisted, preferencesHint);
- case CommentEditPartCN.VISUAL_ID:
- return createComment_54(domainElement, containerView, index, persisted, preferencesHint);
- case ConstraintEditPartCN.VISUAL_ID:
- return createConstraint_56(domainElement, containerView, index, persisted, preferencesHint);
- }
- // can't happen, provided #provides(CreateNodeViewOperation) is correct
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- 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 LinkDescriptorEditPart.VISUAL_ID:
- return createLink_4005(containerView, index, persisted, preferencesHint);
- case CommentAnnotatedElementEditPart.VISUAL_ID:
- return createCommentAnnotatedElement_4008(containerView, index, persisted, preferencesHint);
- case ConstraintConstrainedElementEditPart.VISUAL_ID:
- return createConstraintConstrainedElement_4009(containerView, index, persisted, preferencesHint);
- case DeploymentEditPart.VISUAL_ID:
- return createDeployment_4001(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint);
- case ManifestationEditPart.VISUAL_ID:
- return createManifestation_4002(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint);
- case GeneralizationEditPart.VISUAL_ID:
- return createGeneralization_4003(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint);
- case DependencyEditPart.VISUAL_ID:
- return createDependency_4004(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint);
- case DependencyBranchEditPart.VISUAL_ID:
- return createDependency_4010(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint);
- }
- // can never happen, provided #provides(CreateEdgeViewOperation) is correct
- return null;
- }
-
- /**
- * @generated
- */
- public Node createDependency_2011(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(DependencyNodeEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- stampShortcut(containerView, node);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "DependencyNode");
- Node label7 = createLabel(node, UMLVisualIDRegistry.getType(MultiDependencyLabelEditPart.VISUAL_ID));
- label7.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
- Location location7 = (Location) label7.getLayoutConstraint();
- location7.setX(0);
- location7.setY(5);
- return node;
- }
-
- /**
- * @generated
- */
- public Node createModel_2010(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(ModelEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- stampShortcut(containerView, node);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Model");
- Node label48 = createLabel(node, UMLVisualIDRegistry.getType(ModelNameEditPart.VISUAL_ID));
- createCompartment(node, UMLVisualIDRegistry.getType(ModelPackageableElementCompartmentEditPart.VISUAL_ID), false, true, false, false);
- PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Model");
- return node;
- }
-
- /**
- * @generated
- */
- public Node createPackage_2009(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(PackageEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- stampShortcut(containerView, node);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Package");
- Node label35 = createLabel(node, UMLVisualIDRegistry.getType(PackageNameEditPart.VISUAL_ID));
- createCompartment(node, UMLVisualIDRegistry.getType(PackagePackageableElementCompartmentEditPart.VISUAL_ID), false, true, false, false);
- PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Package");
- return node;
- }
-
- /**
- * @generated
- */
- public Node createConstraint_2005(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(ConstraintEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- stampShortcut(containerView, node);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Constraint");
- Node label2 = createLabel(node, UMLVisualIDRegistry.getType(ConstraintNameEditPart.VISUAL_ID));
- Node label3 = createLabel(node, UMLVisualIDRegistry.getType(ConstraintSpecificationEditPart.VISUAL_ID));
- return node;
- }
-
- /**
- * @generated
- */
- public Node createComment_2001(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(CommentEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- stampShortcut(containerView, node);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Comment");
- Node label1 = createLabel(node, UMLVisualIDRegistry.getType(CommentBodyEditPart.VISUAL_ID));
- return node;
- }
-
- /**
- * @generated
- */
- public Node createExecutionEnvironment_2002(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(ExecutionEnvironmentEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- stampShortcut(containerView, node);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ExecutionEnvironment");
- Node label5 = createLabel(node, UMLVisualIDRegistry.getType(ExecutionEnvironmentNameEditPart.VISUAL_ID));
- createCompartment(node, UMLVisualIDRegistry.getType(ExecutionEnvironmentCompositeCompartmentEditPart.VISUAL_ID), false, true, false, false);
- PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "ExecutionEnvironment");
- return node;
- }
-
- /**
- * @generated
- */
- public Node createDevice_2003(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(DeviceEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- stampShortcut(containerView, node);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Device");
- Node label6 = createLabel(node, UMLVisualIDRegistry.getType(DeviceNameEditPart.VISUAL_ID));
- createCompartment(node, UMLVisualIDRegistry.getType(DeviceCompositeCompartmentEditPart.VISUAL_ID), false, true, false, false);
- PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Device");
- return node;
- }
-
- /**
- * @generated
- */
- public Node createArtifact_2006(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(ArtifactEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- stampShortcut(containerView, node);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Artifact");
- Node label8 = createLabel(node, UMLVisualIDRegistry.getType(ArtifactNameEditPart.VISUAL_ID));
- Node label61 = createLabel(node, UMLVisualIDRegistry.getType(ArtifactFloatingLabelEditPart.VISUAL_ID));
- label61.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
- Location location61 = (Location) label61.getLayoutConstraint();
- location61.setX(25);
- location61.setY(0);
- createCompartment(node, UMLVisualIDRegistry.getType(ArtifactCompositeCompartmentEditPart.VISUAL_ID), true, true, false, false);
- PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Artifact");
- return node;
- }
-
- /**
- * @generated
- */
- public Node createNode_2008(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(NodeEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- stampShortcut(containerView, node);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Node");
- Node label9 = createLabel(node, UMLVisualIDRegistry.getType(NodeNameEditPart.VISUAL_ID));
- createCompartment(node, UMLVisualIDRegistry.getType(NodeCompositeCompartmentEditPart.VISUAL_ID), false, true, false, false);
- PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Node");
- return node;
- }
-
- /**
- * @generated
- */
- public Node createNamedElement_2012(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(DefaultNamedElementEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- stampShortcut(containerView, node);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "DefaultNamedElement");
- Node label53 = createLabel(node, UMLVisualIDRegistry.getType(DefaultNamedElementNameEditPart.VISUAL_ID));
- return node;
- }
-
- /**
- * @generated
- */
- public Node createModel_49(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(ModelEditPartCN.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Model");
- Node label50 = createLabel(node, UMLVisualIDRegistry.getType(ModelNameEditPartCN.VISUAL_ID));
- createCompartment(node, UMLVisualIDRegistry.getType(ModelPackageableElementCompartmentEditPartCN.VISUAL_ID), false, true, false, false);
- PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Model");
- return node;
- }
-
- /**
- * @generated
- */
- public Node createPackage_36(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(PackageEditPartCN.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Package");
- Node label37 = createLabel(node, UMLVisualIDRegistry.getType(PackageNameEditPartCN.VISUAL_ID));
- createCompartment(node, UMLVisualIDRegistry.getType(PackagePackageableElementCompartmentEditPartCN.VISUAL_ID), false, true, false, false);
- PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Package");
- return node;
- }
-
- /**
- * @generated
- */
- public Node createDevice_16(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(DeviceEditPartCN.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Device");
- Node label20 = createLabel(node, UMLVisualIDRegistry.getType(DeviceNameEditPartCN.VISUAL_ID));
- return node;
- }
-
- /**
- * @generated
- */
- public Node createDevice_44(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(NestedDeviceEditPartCN.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Device");
- Node label45 = createLabel(node, UMLVisualIDRegistry.getType(NestedDeviceNameEditPartCN.VISUAL_ID));
- createCompartment(node, UMLVisualIDRegistry.getType(DeviceCompositeCompartmentEditPartCN.VISUAL_ID), true, true, false, false);
- PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Device");
- return node;
- }
-
- /**
- * @generated
- */
- public Node createExecutionEnvironment_21(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(ExecutionEnvironmentEditPartCN.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ExecutionEnvironment");
- Node label22 = createLabel(node, UMLVisualIDRegistry.getType(ExecutionEnvironmentNameEditPartCN.VISUAL_ID));
- return node;
- }
-
- /**
- * @generated
- */
- public Node createExecutionEnvironment_46(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(NestedExecutionEnvironmentEditPartCN.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ExecutionEnvironment");
- Node label47 = createLabel(node, UMLVisualIDRegistry.getType(NestedExecutionEnvironmentNameEditPartCN.VISUAL_ID));
- createCompartment(node, UMLVisualIDRegistry.getType(ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID), true, true, false, false);
- PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "ExecutionEnvironment");
- return node;
- }
-
- /**
- * @generated
- */
- public Node createNode_23(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(NodeEditPartCN.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Node");
- Node label24 = createLabel(node, UMLVisualIDRegistry.getType(NodeNameEditPartCN.VISUAL_ID));
- return node;
- }
-
- /**
- * @generated
- */
- public Node createNode_42(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(NestedNodeEditPartCN.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Node");
- Node label43 = createLabel(node, UMLVisualIDRegistry.getType(NestedNodeNameEditPart.VISUAL_ID));
- createCompartment(node, UMLVisualIDRegistry.getType(NodeCompositeCompartmentEditPartCN.VISUAL_ID), true, true, false, false);
- PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Node");
- return node;
- }
-
- /**
- * @generated
- */
- public Node createArtifact_25(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(ArtifactEditPartCN.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Artifact");
- Node label27 = createLabel(node, UMLVisualIDRegistry.getType(ArtifactNameEditPartCN.VISUAL_ID));
- Node label59 = createLabel(node, UMLVisualIDRegistry.getType(ArtifactFloatingLabelEditPartCN.VISUAL_ID));
- label59.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
- Location location59 = (Location) label59.getLayoutConstraint();
- location59.setX(25);
- location59.setY(0);
- createCompartment(node, UMLVisualIDRegistry.getType(ArtifactCompositeCompartmentEditPartCN.VISUAL_ID), true, true, false, false);
- PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Artifact");
- return node;
- }
-
- /**
- * @generated
- */
- public Node createArtifact_28(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(ArtifactEditPartACN.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Artifact");
- Node label29 = createLabel(node, UMLVisualIDRegistry.getType(ArtifactNameEditPartACN.VISUAL_ID));
- Node label60 = createLabel(node, UMLVisualIDRegistry.getType(ArtifactFloatingLabelEditPartACN.VISUAL_ID));
- label60.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
- Location location60 = (Location) label60.getLayoutConstraint();
- location60.setX(25);
- location60.setY(0);
- createCompartment(node, UMLVisualIDRegistry.getType(ArtifactCompositeCompartmentEditPartACN.VISUAL_ID), true, true, false, false);
- PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Artifact");
- return node;
- }
-
- /**
- * @generated
- */
- public Node createArtifact_40(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(NestedArtifactNodeEditPartCN.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Artifact");
- Node label41 = createLabel(node, UMLVisualIDRegistry.getType(NestedArtifactNameEditPart.VISUAL_ID));
- return node;
- }
-
- /**
- * @generated
- */
- public Node createComment_54(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(CommentEditPartCN.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Comment");
- Node label55 = createLabel(node, UMLVisualIDRegistry.getType(CommentBodyEditPartCN.VISUAL_ID));
- return node;
- }
-
- /**
- * @generated
- */
- public Node createConstraint_56(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(ConstraintEditPartCN.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Constraint");
- Node label57 = createLabel(node, UMLVisualIDRegistry.getType(ConstraintNameEditPartCN.VISUAL_ID));
- Node label58 = createLabel(node, UMLVisualIDRegistry.getType(ConstraintSpecificationEditPartCN.VISUAL_ID));
- return node;
- }
-
- /**
- * @generated
- */
- public Edge createLink_4005(View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Connector edge = NotationFactory.eINSTANCE.createConnector();
- edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
- RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
- List<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(LinkDescriptorEditPart.VISUAL_ID));
- edge.setElement(null);
- // initializePreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- // 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);
- // }
-
- return edge;
- }
-
- /**
- * @generated
- */
- public Edge createCommentAnnotatedElement_4008(View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Connector edge = NotationFactory.eINSTANCE.createConnector();
- edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
- RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
- List<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(CommentAnnotatedElementEditPart.VISUAL_ID));
- edge.setElement(null);
- // initializePreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "CommentAnnotatedElement");
- // 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);
- // }
-
- return edge;
- }
-
- /**
- * @generated
- */
- public Edge createConstraintConstrainedElement_4009(View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Connector edge = NotationFactory.eINSTANCE.createConnector();
- edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
- RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
- List<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(ConstraintConstrainedElementEditPart.VISUAL_ID));
- edge.setElement(null);
- // initializePreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "ConstraintConstrainedElement");
- // 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);
- // }
-
- return edge;
- }
-
- /**
- * @generated
- */
- public Edge createDeployment_4001(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();
- List<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(DeploymentEditPart.VISUAL_ID));
- edge.setElement(domainElement);
- // initializePreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "Deployment");
- // 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);
- // }
- Node label13 = createLabel(edge, UMLVisualIDRegistry.getType(DeploymentNameEditPart.VISUAL_ID));
- label13.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
- Location location13 = (Location) label13.getLayoutConstraint();
- location13.setX(0);
- location13.setY(60);
- Node label14 = createLabel(edge, UMLVisualIDRegistry.getType(DeploymentAppliedStereotypeEditPart.VISUAL_ID));
- label14.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
- Location location14 = (Location) label14.getLayoutConstraint();
- location14.setX(0);
- location14.setY(60);
-
- PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "Deployment");
- return edge;
- }
-
- /**
- * @generated
- */
- public Edge createManifestation_4002(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();
- List<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(ManifestationEditPart.VISUAL_ID));
- edge.setElement(domainElement);
- // initializePreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "Manifestation");
- // 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);
- // }
- Node label10 = createLabel(edge, UMLVisualIDRegistry.getType(ManifestationNameEditPart.VISUAL_ID));
- label10.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
- Location location10 = (Location) label10.getLayoutConstraint();
- location10.setX(0);
- location10.setY(60);
- Node label11 = createLabel(edge, UMLVisualIDRegistry.getType(ManifestationAppliedStereotypeEditPart.VISUAL_ID));
- label11.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
- Location location11 = (Location) label11.getLayoutConstraint();
- location11.setX(0);
- location11.setY(30);
-
- PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "Manifestation");
- return edge;
- }
-
- /**
- * @generated
- */
- public Edge createGeneralization_4003(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();
- List<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.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);
- // }
- Node label4 = createLabel(edge, UMLVisualIDRegistry.getType(GeneralizationAppliedStereotypeEditPart.VISUAL_ID));
- label4.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
- Location location4 = (Location) label4.getLayoutConstraint();
- location4.setX(0);
- location4.setY(60);
-
- PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "Generalization");
- return edge;
- }
-
- /**
- * @generated
- */
- public Edge createDependency_4004(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();
- List<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(DependencyEditPart.VISUAL_ID));
- edge.setElement(domainElement);
- // initializePreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "DependencyLink");
- // 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);
- // }
- Node label12 = createLabel(edge, UMLVisualIDRegistry.getType(DependencyNameEditPart.VISUAL_ID));
- label12.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
- Location location12 = (Location) label12.getLayoutConstraint();
- location12.setX(0);
- location12.setY(40);
- Node label15 = createLabel(edge, UMLVisualIDRegistry.getType(DependencyAppliedStereotypeEditPart.VISUAL_ID));
- label15.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
- Location location15 = (Location) label15.getLayoutConstraint();
- location15.setX(0);
- location15.setY(60);
-
- PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "DependencyLink");
- return edge;
- }
-
- /**
- * @generated
- */
- public Edge createDependency_4010(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();
- List<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(DependencyBranchEditPart.VISUAL_ID));
- edge.setElement(domainElement);
- // initializePreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
-
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "DependencyBranchLink");
- // 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);
- // }
-
- return edge;
- }
-
- /**
- * @generated
- */
- protected void stampShortcut(View containerView, Node target) {
- if (!DeploymentDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
- EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
- shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
- shortcutAnnotation.getDetails().put("modelID", DeploymentDiagramEditPart.MODEL_ID); //$NON-NLS-1$
- target.getEAnnotations().add(shortcutAnnotation);
- }
- }
-
- /**
- * @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
- */
- 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();
- rv.getStyles().add(ts);
- }
- if (canSort) {
- rv.getStyles().add(NotationFactory.eINSTANCE.createSortingStyle());
- }
- if (canFilter) {
- rv.getStyles().add(NotationFactory.eINSTANCE.createFilteringStyle());
- }
- rv.setType(hint);
- ViewUtil.insertChildView(owner, rv, ViewUtil.APPEND, true);
- return rv;
- }
-
- /**
- * @generated
- */
- protected EObject getSemanticElement(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 initFontStyleFromPrefs(View view, final IPreferenceStore store, String elementName) {
- String fontConstant = PreferencesConstantsHelper.getElementConstant(elementName, PreferencesConstantsHelper.FONT);
- String fontColorConstant = PreferencesConstantsHelper.getElementConstant(elementName, PreferencesConstantsHelper.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 = PreferencesConstantsHelper.getElementConstant(elementName, PreferencesConstantsHelper.COLOR_LINE);
- org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(store, lineColorConstant);
- ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLineStyle_LineColor(), FigureUtilities.RGBToInteger(lineRGB));
- }
-
- /**
- * @generated
- */
- private void initBackgroundFromPrefs(View view, final IPreferenceStore store, String elementName) {
- String fillColorConstant = PreferencesConstantsHelper.getElementConstant(elementName, PreferencesConstantsHelper.COLOR_FILL);
- String gradientColorConstant = PreferencesConstantsHelper.getElementConstant(elementName, PreferencesConstantsHelper.COLOR_GRADIENT);
- String gradientPolicyConstant = PreferencesConstantsHelper.getElementConstant(elementName, PreferencesConstantsHelper.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());
- }
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.providers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.core.providers.IViewProvider;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewOperation;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.notation.Connector;
+import org.eclipse.gmf.runtime.notation.DecorationNode;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.FillStyle;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.MeasurementUnit;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.RelativeBendpoints;
+import org.eclipse.gmf.runtime.notation.Shape;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramVersioningUtils;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactCompositeCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactCompositeCompartmentEditPartACN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactCompositeCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPartACN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartACN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactFloatingLabelEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPartACN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ArtifactNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentAnnotatedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentBodyEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentBodyEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.CommentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintConstrainedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintSpecificationEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ConstraintSpecificationEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DefaultNamedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DefaultNamedElementNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyBranchEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNodeEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceCompositeCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceCompositeCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentCompositeCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentCompositeCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.GeneralizationEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.LinkDescriptorEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationAppliedStereotypeEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelPackageableElementCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ModelPackageableElementCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.MultiDependencyLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedArtifactNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedArtifactNodeEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedDeviceEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedDeviceNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedExecutionEnvironmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedExecutionEnvironmentNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedNodeEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NestedNodeNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeCompositeCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeCompositeCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.NodeNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageNameEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackagePackageableElementCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackagePackageableElementCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.FontData;
+
+/**
+ * @generated
+ */
+public class UMLViewProvider extends AbstractProvider implements IViewProvider {
+
+ /**
+ * @generated
+ */
+ @Override
+ 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 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;
+ */
+
+ // check Diagram Type should be the class diagram
+ String modelID = UMLVisualIDRegistry.getModelID(op.getContainerView());
+ if (!getDiagramProvidedId().equals(modelID)) {
+ return false;
+ }
+
+ int visualID = UMLVisualIDRegistry.getVisualID(op.getSemanticHint());
+ if (Node.class.isAssignableFrom(op.getViewKind())) {
+ return UMLVisualIDRegistry.canCreateNode(op.getContainerView(), visualID);
+ }
+
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDiagramProvidedId() {
+ /*
+ * Indicates for which diagram this provider works for.
+ * <p>
+ * This method can be overloaded when diagram editor inherits from another one, but should never be <code>null</code>
+ * </p>
+ *
+ * @return the unique identifier of the diagram for which views are provided.
+ */
+ return DeploymentDiagramEditPart.MODEL_ID;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean provides(CreateDiagramViewOperation op) {
+ return DeploymentDiagramEditPart.MODEL_ID.equals(op.getSemanticHint()) && UMLVisualIDRegistry.getDiagramVisualID(getSemanticElement(op.getSemanticAdapter())) != -1;
+ }
+
+ /**
+ * @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 != org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getNodeVisualID(op.getContainerView(), domainElement)) {
+ // return false; // visual id for node EClass should match visual id from element type
+ //}
+ } else {
+ if (!DeploymentDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(op.getContainerView()))) {
+ return false; // foreign diagram
+ }
+ switch (visualID) {
+ case DependencyNodeEditPart.VISUAL_ID:
+ case ConstraintEditPart.VISUAL_ID:
+ case CommentEditPart.VISUAL_ID:
+ case ExecutionEnvironmentEditPart.VISUAL_ID:
+ case DeviceEditPart.VISUAL_ID:
+ case ArtifactEditPart.VISUAL_ID:
+ case NodeEditPart.VISUAL_ID:
+ case DefaultNamedElementEditPart.VISUAL_ID:
+ case CommentEditPartCN.VISUAL_ID:
+ case ConstraintEditPartCN.VISUAL_ID:
+ case ModelEditPart.VISUAL_ID:
+ case PackageEditPart.VISUAL_ID:
+ case ModelEditPartCN.VISUAL_ID:
+ case PackageEditPartCN.VISUAL_ID:
+ case DeviceEditPartCN.VISUAL_ID:
+ case NestedDeviceEditPartCN.VISUAL_ID:
+ case ExecutionEnvironmentEditPartCN.VISUAL_ID:
+ case NestedExecutionEnvironmentEditPartCN.VISUAL_ID:
+ case NodeEditPartCN.VISUAL_ID:
+ case NestedNodeEditPartCN.VISUAL_ID:
+ case ArtifactEditPartCN.VISUAL_ID:
+ case ArtifactEditPartACN.VISUAL_ID:
+ case NestedArtifactNodeEditPartCN.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 UMLVisualIDRegistry.canCreateNode(op.getContainerView(), visualID);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean provides(CreateEdgeViewOperation op) {
+ IElementType elementType = getSemanticElementType(op.getSemanticAdapter());
+ //RS: add code for extended types creation
+ if (elementType instanceof IExtendedHintedElementType) {
+ IElementType closestNonExtendedType = ElementTypeUtils.getClosestDiagramType(elementType);
+ if (!UMLElementTypes.isKnownElementType(closestNonExtendedType) || (!(closestNonExtendedType instanceof IHintedType))) {
+ return false; // foreign element type.
+ }
+ } else {
+ if (!UMLElementTypes.isKnownElementType(elementType) || (!(elementType instanceof IHintedType))) {
+ return false; // foreign element type
+ }
+ }
+ //if (!org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes.isKnownElementType(elementType) || (!(elementType instanceof org.eclipse.gmf.runtime.emf.type.core.IHintedType))) {
+ // return false; // foreign element type
+ //}
+ // END R.S.
+ 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 = org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getVisualID(elementTypeHint);
+ //org.eclipse.emf.ecore.EObject domainElement = getSemanticElement(op.getSemanticAdapter());
+ //if (domainElement != null && visualID != org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry.getLinkWithClassVisualID(domainElement)) {
+ // return false; // visual id for link EClass should match visual id from element type
+ //}
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public Diagram createDiagram(IAdaptable semanticAdapter, String diagramKind, PreferencesHint preferencesHint) {
+ Diagram diagram = NotationFactory.eINSTANCE.createDiagram();
+ DiagramVersioningUtils.stampCurrentVersion(diagram);
+ diagram.getStyles().add(NotationFactory.eINSTANCE.createDiagramStyle());
+ diagram.setType(DeploymentDiagramEditPart.MODEL_ID);
+ diagram.setElement(getSemanticElement(semanticAdapter));
+ diagram.setMeasurementUnit(MeasurementUnit.PIXEL_LITERAL);
+ return diagram;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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 DependencyNodeEditPart.VISUAL_ID:
+ return createDependency_2011(domainElement, containerView, index, persisted, preferencesHint);
+ case ModelEditPart.VISUAL_ID:
+ return createModel_2010(domainElement, containerView, index, persisted, preferencesHint);
+ case PackageEditPart.VISUAL_ID:
+ return createPackage_2009(domainElement, containerView, index, persisted, preferencesHint);
+ case ConstraintEditPart.VISUAL_ID:
+ return createConstraint_2005(domainElement, containerView, index, persisted, preferencesHint);
+ case CommentEditPart.VISUAL_ID:
+ return createComment_2001(domainElement, containerView, index, persisted, preferencesHint);
+ case ExecutionEnvironmentEditPart.VISUAL_ID:
+ return createExecutionEnvironment_2002(domainElement, containerView, index, persisted, preferencesHint);
+ case DeviceEditPart.VISUAL_ID:
+ return createDevice_2003(domainElement, containerView, index, persisted, preferencesHint);
+ case ArtifactEditPart.VISUAL_ID:
+ return createArtifact_2006(domainElement, containerView, index, persisted, preferencesHint);
+ case NodeEditPart.VISUAL_ID:
+ return createNode_2008(domainElement, containerView, index, persisted, preferencesHint);
+ case DefaultNamedElementEditPart.VISUAL_ID:
+ return createNamedElement_2012(domainElement, containerView, index, persisted, preferencesHint);
+ case ModelEditPartCN.VISUAL_ID:
+ return createModel_49(domainElement, containerView, index, persisted, preferencesHint);
+ case PackageEditPartCN.VISUAL_ID:
+ return createPackage_36(domainElement, containerView, index, persisted, preferencesHint);
+ case DeviceEditPartCN.VISUAL_ID:
+ return createDevice_16(domainElement, containerView, index, persisted, preferencesHint);
+ case NestedDeviceEditPartCN.VISUAL_ID:
+ return createDevice_44(domainElement, containerView, index, persisted, preferencesHint);
+ case ExecutionEnvironmentEditPartCN.VISUAL_ID:
+ return createExecutionEnvironment_21(domainElement, containerView, index, persisted, preferencesHint);
+ case NestedExecutionEnvironmentEditPartCN.VISUAL_ID:
+ return createExecutionEnvironment_46(domainElement, containerView, index, persisted, preferencesHint);
+ case NodeEditPartCN.VISUAL_ID:
+ return createNode_23(domainElement, containerView, index, persisted, preferencesHint);
+ case NestedNodeEditPartCN.VISUAL_ID:
+ return createNode_42(domainElement, containerView, index, persisted, preferencesHint);
+ case ArtifactEditPartCN.VISUAL_ID:
+ return createArtifact_25(domainElement, containerView, index, persisted, preferencesHint);
+ case ArtifactEditPartACN.VISUAL_ID:
+ return createArtifact_28(domainElement, containerView, index, persisted, preferencesHint);
+ case NestedArtifactNodeEditPartCN.VISUAL_ID:
+ return createArtifact_40(domainElement, containerView, index, persisted, preferencesHint);
+ case CommentEditPartCN.VISUAL_ID:
+ return createComment_54(domainElement, containerView, index, persisted, preferencesHint);
+ case ConstraintEditPartCN.VISUAL_ID:
+ return createConstraint_56(domainElement, containerView, index, persisted, preferencesHint);
+ }
+ // can't happen, provided #provides(CreateNodeViewOperation) is correct
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ 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 LinkDescriptorEditPart.VISUAL_ID:
+ return createLink_4005(containerView, index, persisted, preferencesHint);
+ case CommentAnnotatedElementEditPart.VISUAL_ID:
+ return createCommentAnnotatedElement_4008(containerView, index, persisted, preferencesHint);
+ case ConstraintConstrainedElementEditPart.VISUAL_ID:
+ return createConstraintConstrainedElement_4009(containerView, index, persisted, preferencesHint);
+ case DeploymentEditPart.VISUAL_ID:
+ return createDeployment_4001(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint);
+ case ManifestationEditPart.VISUAL_ID:
+ return createManifestation_4002(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint);
+ case GeneralizationEditPart.VISUAL_ID:
+ return createGeneralization_4003(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint);
+ case DependencyEditPart.VISUAL_ID:
+ return createDependency_4004(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint);
+ case DependencyBranchEditPart.VISUAL_ID:
+ return createDependency_4010(getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint);
+ }
+ // can never happen, provided #provides(CreateEdgeViewOperation) is correct
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createDependency_2011(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(DependencyNodeEditPart.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ stampShortcut(containerView, node);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "DependencyNode");
+ Node label7 = createLabel(node, UMLVisualIDRegistry.getType(MultiDependencyLabelEditPart.VISUAL_ID));
+ label7.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ Location location7 = (Location) label7.getLayoutConstraint();
+ location7.setX(0);
+ location7.setY(5);
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createModel_2010(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(ModelEditPart.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ stampShortcut(containerView, node);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Model");
+ Node label48 = createLabel(node, UMLVisualIDRegistry.getType(ModelNameEditPart.VISUAL_ID));
+ createCompartment(node, UMLVisualIDRegistry.getType(ModelPackageableElementCompartmentEditPart.VISUAL_ID), false, true, false, false);
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Model");
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createPackage_2009(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(PackageEditPart.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ stampShortcut(containerView, node);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Package");
+ Node label35 = createLabel(node, UMLVisualIDRegistry.getType(PackageNameEditPart.VISUAL_ID));
+ createCompartment(node, UMLVisualIDRegistry.getType(PackagePackageableElementCompartmentEditPart.VISUAL_ID), false, true, false, false);
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Package");
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createConstraint_2005(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(ConstraintEditPart.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ stampShortcut(containerView, node);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Constraint");
+ Node label2 = createLabel(node, UMLVisualIDRegistry.getType(ConstraintNameEditPart.VISUAL_ID));
+ Node label3 = createLabel(node, UMLVisualIDRegistry.getType(ConstraintSpecificationEditPart.VISUAL_ID));
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createComment_2001(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(CommentEditPart.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ stampShortcut(containerView, node);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Comment");
+ Node label1 = createLabel(node, UMLVisualIDRegistry.getType(CommentBodyEditPart.VISUAL_ID));
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createExecutionEnvironment_2002(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(ExecutionEnvironmentEditPart.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ stampShortcut(containerView, node);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ExecutionEnvironment");
+ Node label5 = createLabel(node, UMLVisualIDRegistry.getType(ExecutionEnvironmentNameEditPart.VISUAL_ID));
+ createCompartment(node, UMLVisualIDRegistry.getType(ExecutionEnvironmentCompositeCompartmentEditPart.VISUAL_ID), false, true, false, false);
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "ExecutionEnvironment");
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createDevice_2003(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(DeviceEditPart.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ stampShortcut(containerView, node);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Device");
+ Node label6 = createLabel(node, UMLVisualIDRegistry.getType(DeviceNameEditPart.VISUAL_ID));
+ createCompartment(node, UMLVisualIDRegistry.getType(DeviceCompositeCompartmentEditPart.VISUAL_ID), false, true, false, false);
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Device");
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createArtifact_2006(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(ArtifactEditPart.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ stampShortcut(containerView, node);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Artifact");
+ Node label8 = createLabel(node, UMLVisualIDRegistry.getType(ArtifactNameEditPart.VISUAL_ID));
+ Node label61 = createLabel(node, UMLVisualIDRegistry.getType(ArtifactFloatingLabelEditPart.VISUAL_ID));
+ label61.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ Location location61 = (Location) label61.getLayoutConstraint();
+ location61.setX(25);
+ location61.setY(0);
+ createCompartment(node, UMLVisualIDRegistry.getType(ArtifactCompositeCompartmentEditPart.VISUAL_ID), true, true, false, false);
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Artifact");
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createNode_2008(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(NodeEditPart.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ stampShortcut(containerView, node);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Node");
+ Node label9 = createLabel(node, UMLVisualIDRegistry.getType(NodeNameEditPart.VISUAL_ID));
+ createCompartment(node, UMLVisualIDRegistry.getType(NodeCompositeCompartmentEditPart.VISUAL_ID), false, true, false, false);
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Node");
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createNamedElement_2012(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(DefaultNamedElementEditPart.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ stampShortcut(containerView, node);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "DefaultNamedElement");
+ Node label53 = createLabel(node, UMLVisualIDRegistry.getType(DefaultNamedElementNameEditPart.VISUAL_ID));
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createModel_49(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(ModelEditPartCN.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Model");
+ Node label50 = createLabel(node, UMLVisualIDRegistry.getType(ModelNameEditPartCN.VISUAL_ID));
+ createCompartment(node, UMLVisualIDRegistry.getType(ModelPackageableElementCompartmentEditPartCN.VISUAL_ID), false, true, false, false);
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Model");
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createPackage_36(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(PackageEditPartCN.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Package");
+ Node label37 = createLabel(node, UMLVisualIDRegistry.getType(PackageNameEditPartCN.VISUAL_ID));
+ createCompartment(node, UMLVisualIDRegistry.getType(PackagePackageableElementCompartmentEditPartCN.VISUAL_ID), false, true, false, false);
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Package");
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createDevice_16(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(DeviceEditPartCN.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Device");
+ Node label20 = createLabel(node, UMLVisualIDRegistry.getType(DeviceNameEditPartCN.VISUAL_ID));
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createDevice_44(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(NestedDeviceEditPartCN.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Device");
+ Node label45 = createLabel(node, UMLVisualIDRegistry.getType(NestedDeviceNameEditPartCN.VISUAL_ID));
+ createCompartment(node, UMLVisualIDRegistry.getType(DeviceCompositeCompartmentEditPartCN.VISUAL_ID), true, true, false, false);
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Device");
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createExecutionEnvironment_21(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(ExecutionEnvironmentEditPartCN.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ExecutionEnvironment");
+ Node label22 = createLabel(node, UMLVisualIDRegistry.getType(ExecutionEnvironmentNameEditPartCN.VISUAL_ID));
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createExecutionEnvironment_46(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(NestedExecutionEnvironmentEditPartCN.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ExecutionEnvironment");
+ Node label47 = createLabel(node, UMLVisualIDRegistry.getType(NestedExecutionEnvironmentNameEditPartCN.VISUAL_ID));
+ createCompartment(node, UMLVisualIDRegistry.getType(ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID), true, true, false, false);
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "ExecutionEnvironment");
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createNode_23(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(NodeEditPartCN.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Node");
+ Node label24 = createLabel(node, UMLVisualIDRegistry.getType(NodeNameEditPartCN.VISUAL_ID));
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createNode_42(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(NestedNodeEditPartCN.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Node");
+ Node label43 = createLabel(node, UMLVisualIDRegistry.getType(NestedNodeNameEditPart.VISUAL_ID));
+ createCompartment(node, UMLVisualIDRegistry.getType(NodeCompositeCompartmentEditPartCN.VISUAL_ID), true, true, false, false);
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Node");
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createArtifact_25(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(ArtifactEditPartCN.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Artifact");
+ Node label27 = createLabel(node, UMLVisualIDRegistry.getType(ArtifactNameEditPartCN.VISUAL_ID));
+ Node label59 = createLabel(node, UMLVisualIDRegistry.getType(ArtifactFloatingLabelEditPartCN.VISUAL_ID));
+ label59.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ Location location59 = (Location) label59.getLayoutConstraint();
+ location59.setX(25);
+ location59.setY(0);
+ createCompartment(node, UMLVisualIDRegistry.getType(ArtifactCompositeCompartmentEditPartCN.VISUAL_ID), true, true, false, false);
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Artifact");
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createArtifact_28(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(ArtifactEditPartACN.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Artifact");
+ Node label29 = createLabel(node, UMLVisualIDRegistry.getType(ArtifactNameEditPartACN.VISUAL_ID));
+ Node label60 = createLabel(node, UMLVisualIDRegistry.getType(ArtifactFloatingLabelEditPartACN.VISUAL_ID));
+ label60.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ Location location60 = (Location) label60.getLayoutConstraint();
+ location60.setX(25);
+ location60.setY(0);
+ createCompartment(node, UMLVisualIDRegistry.getType(ArtifactCompositeCompartmentEditPartACN.VISUAL_ID), true, true, false, false);
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Artifact");
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createArtifact_40(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(NestedArtifactNodeEditPartCN.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Artifact");
+ Node label41 = createLabel(node, UMLVisualIDRegistry.getType(NestedArtifactNameEditPart.VISUAL_ID));
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createComment_54(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(CommentEditPartCN.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Comment");
+ Node label55 = createLabel(node, UMLVisualIDRegistry.getType(CommentBodyEditPartCN.VISUAL_ID));
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Node createConstraint_56(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(ConstraintEditPartCN.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Constraint");
+ Node label57 = createLabel(node, UMLVisualIDRegistry.getType(ConstraintNameEditPartCN.VISUAL_ID));
+ Node label58 = createLabel(node, UMLVisualIDRegistry.getType(ConstraintSpecificationEditPartCN.VISUAL_ID));
+ return node;
+ }
+
+ /**
+ * @generated
+ */
+ public Edge createLink_4005(View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Connector edge = NotationFactory.eINSTANCE.createConnector();
+ edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
+ RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
+ List<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(LinkDescriptorEditPart.VISUAL_ID));
+ edge.setElement(null);
+ // initializePreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ //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);
+ //}
+
+ return edge;
+ }
+
+ /**
+ * @generated
+ */
+ public Edge createCommentAnnotatedElement_4008(View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Connector edge = NotationFactory.eINSTANCE.createConnector();
+ edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
+ RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
+ List<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(CommentAnnotatedElementEditPart.VISUAL_ID));
+ edge.setElement(null);
+ // initializePreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "CommentAnnotatedElement");
+ //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);
+ //}
+
+ return edge;
+ }
+
+ /**
+ * @generated
+ */
+ public Edge createConstraintConstrainedElement_4009(View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Connector edge = NotationFactory.eINSTANCE.createConnector();
+ edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
+ RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
+ List<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(ConstraintConstrainedElementEditPart.VISUAL_ID));
+ edge.setElement(null);
+ // initializePreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "ConstraintConstrainedElement");
+ //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);
+ //}
+
+ return edge;
+ }
+
+ /**
+ * @generated
+ */
+ public Edge createDeployment_4001(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();
+ List<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(DeploymentEditPart.VISUAL_ID));
+ edge.setElement(domainElement);
+ // initializePreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "Deployment");
+ //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);
+ //}
+ Node label13 = createLabel(edge, UMLVisualIDRegistry.getType(DeploymentNameEditPart.VISUAL_ID));
+ label13.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ Location location13 = (Location) label13.getLayoutConstraint();
+ location13.setX(0);
+ location13.setY(60);
+ Node label14 = createLabel(edge, UMLVisualIDRegistry.getType(DeploymentAppliedStereotypeEditPart.VISUAL_ID));
+ label14.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ Location location14 = (Location) label14.getLayoutConstraint();
+ location14.setX(0);
+ location14.setY(60);
+
+ PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "Deployment");
+ return edge;
+ }
+
+ /**
+ * @generated
+ */
+ public Edge createManifestation_4002(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();
+ List<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(ManifestationEditPart.VISUAL_ID));
+ edge.setElement(domainElement);
+ // initializePreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "Manifestation");
+ //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);
+ //}
+ Node label10 = createLabel(edge, UMLVisualIDRegistry.getType(ManifestationNameEditPart.VISUAL_ID));
+ label10.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ Location location10 = (Location) label10.getLayoutConstraint();
+ location10.setX(0);
+ location10.setY(60);
+ Node label11 = createLabel(edge, UMLVisualIDRegistry.getType(ManifestationAppliedStereotypeEditPart.VISUAL_ID));
+ label11.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ Location location11 = (Location) label11.getLayoutConstraint();
+ location11.setX(0);
+ location11.setY(30);
+
+ PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "Manifestation");
+ return edge;
+ }
+
+ /**
+ * @generated
+ */
+ public Edge createGeneralization_4003(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();
+ List<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.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);
+ //}
+ Node label4 = createLabel(edge, UMLVisualIDRegistry.getType(GeneralizationAppliedStereotypeEditPart.VISUAL_ID));
+ label4.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ Location location4 = (Location) label4.getLayoutConstraint();
+ location4.setX(0);
+ location4.setY(60);
+
+ PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "Generalization");
+ return edge;
+ }
+
+ /**
+ * @generated
+ */
+ public Edge createDependency_4004(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();
+ List<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(DependencyEditPart.VISUAL_ID));
+ edge.setElement(domainElement);
+ // initializePreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "DependencyLink");
+ //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);
+ //}
+ Node label12 = createLabel(edge, UMLVisualIDRegistry.getType(DependencyNameEditPart.VISUAL_ID));
+ label12.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ Location location12 = (Location) label12.getLayoutConstraint();
+ location12.setX(0);
+ location12.setY(40);
+ Node label15 = createLabel(edge, UMLVisualIDRegistry.getType(DependencyAppliedStereotypeEditPart.VISUAL_ID));
+ label15.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ Location location15 = (Location) label15.getLayoutConstraint();
+ location15.setX(0);
+ location15.setY(60);
+
+ PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "DependencyLink");
+ return edge;
+ }
+
+ /**
+ * @generated
+ */
+ public Edge createDependency_4010(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();
+ List<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(DependencyBranchEditPart.VISUAL_ID));
+ edge.setElement(domainElement);
+ // initializePreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "DependencyBranchLink");
+ //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);
+ //}
+
+ return edge;
+ }
+
+ /**
+ * @generated
+ */
+ protected void stampShortcut(View containerView, Node target) {
+ if (!DeploymentDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
+ EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
+ shortcutAnnotation.getDetails().put("modelID", DeploymentDiagramEditPart.MODEL_ID); //$NON-NLS-1$
+ target.getEAnnotations().add(shortcutAnnotation);
+ }
+ }
+
+ /**
+ * @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
+ */
+ 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();
+ rv.getStyles().add(ts);
+ }
+ if (canSort) {
+ rv.getStyles().add(NotationFactory.eINSTANCE.createSortingStyle());
+ }
+ if (canFilter) {
+ rv.getStyles().add(NotationFactory.eINSTANCE.createFilteringStyle());
+ }
+ rv.setType(hint);
+ ViewUtil.insertChildView(owner, rv, ViewUtil.APPEND, true);
+ return rv;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getSemanticElement(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 initFontStyleFromPrefs(View view, final IPreferenceStore store, String elementName) {
+ String fontConstant = PreferencesConstantsHelper.getElementConstant(elementName, PreferencesConstantsHelper.FONT);
+ String fontColorConstant = PreferencesConstantsHelper.getElementConstant(elementName, PreferencesConstantsHelper.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 = PreferencesConstantsHelper.getElementConstant(elementName, PreferencesConstantsHelper.COLOR_LINE);
+ org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(store, lineColorConstant);
+ ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLineStyle_LineColor(), FigureUtilities.RGBToInteger(lineRGB));
+ }
+
+ /**
+ * @generated
+ */
+ private void initBackgroundFromPrefs(View view, final IPreferenceStore store, String elementName) {
+ String fillColorConstant = PreferencesConstantsHelper.getElementConstant(elementName, PreferencesConstantsHelper.COLOR_FILL);
+ String gradientColorConstant = PreferencesConstantsHelper.getElementConstant(elementName, PreferencesConstantsHelper.COLOR_GRADIENT);
+ String gradientPolicyConstant = PreferencesConstantsHelper.getElementConstant(elementName, PreferencesConstantsHelper.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());
+ }
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/sheet/UMLPropertySection.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/sheet/UMLPropertySection.java
index fcc55381e8f..ff6ecb2e31d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/sheet/UMLPropertySection.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/sheet/UMLPropertySection.java
@@ -1,32 +1,32 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.sheet;
-
-import org.eclipse.gmf.tooling.runtime.sheet.DefaultPropertySection;
-import org.eclipse.ui.views.properties.IPropertySourceProvider;
-
-/**
- * @generated
- */
-public class UMLPropertySection extends DefaultPropertySection implements IPropertySourceProvider {
-
- /**
- * Modify/unwrap selection.
- *
- * @generated
- */
- @Override
- protected Object transformSelection(Object selected) {
- selected = /* super. */transformSelectionToDomain(selected);
- return selected;
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.sheet;
+
+import org.eclipse.gmf.tooling.runtime.sheet.DefaultPropertySection;
+import org.eclipse.ui.views.properties.IPropertySourceProvider;
+
+/**
+ * @generated
+ */
+public class UMLPropertySection extends DefaultPropertySection implements IPropertySourceProvider {
+
+ /**
+ * Modify/unwrap selection.
+ *
+ * @generated
+ */
+ @Override
+ protected Object transformSelection(Object selected) {
+ selected = /*super.*/transformSelectionToDomain(selected);
+ return selected;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/sheet/UMLSheetLabelProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/sheet/UMLSheetLabelProvider.java
index 68380e6bde4..31f8e16513f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/sheet/UMLSheetLabelProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/sheet/UMLSheetLabelProvider.java
@@ -1,88 +1,86 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.deployment.sheet;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.viewers.BaseLabelProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @generated
- */
-public class UMLSheetLabelProvider extends BaseLabelProvider implements ILabelProvider {
-
- /**
- * @generated
- */
- @Override
- public String getText(Object element) {
- element = unwrap(element);
- IElementType etype = getElementType(getView(element));
- return etype == null ? "" : etype.getDisplayName();
- }
-
- /**
- * @generated
- */
- @Override
- public Image getImage(Object element) {
- IElementType etype = getElementType(getView(unwrap(element)));
- return etype == null ? null : UMLElementTypes.getImage(etype);
- }
-
- /**
- * @generated
- */
- private Object unwrap(Object element) {
- if (element instanceof IStructuredSelection) {
- return ((IStructuredSelection) element).getFirstElement();
- }
- return element;
- }
-
- /**
- * @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 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;
- }
-}
+/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.deployment.sheet;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.BaseLabelProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class UMLSheetLabelProvider extends BaseLabelProvider implements ILabelProvider {
+
+ /**
+ * @generated
+ */
+ @Override
+ public String getText(Object element) {
+ element = unwrap(element);
+ IElementType etype = getElementType(getView(element));
+ return etype == null ? "" : etype.getDisplayName();
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ public Image getImage(Object element) {
+ IElementType etype = getElementType(getView(unwrap(element)));
+ return etype == null ? null : UMLElementTypes.getImage(etype);
+ }
+
+ /**
+ * @generated
+ */
+ private Object unwrap(Object element) {
+ if (element instanceof IStructuredSelection) {
+ return ((IStructuredSelection) element).getFirstElement();
+ }
+ return element;
+ }
+
+ /**
+ * @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 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;
+ }
+}

Back to the top