Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/AbstractionCreateCommand.java11
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/AbstractionReorientCommand.java24
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentAnnotatedElementCreateCommand.java5
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentAnnotatedElementReorientCommand.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentCreateCommand.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentCreateCommandPCN.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommand.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommandCN.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommandPCN.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentRealizationCreateCommand.java11
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentRealizationReorientCommand.java24
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConnectorCreateCommand.java11
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConnectorReorientCommand.java24
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintConstrainedElementCreateCommand.java5
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintConstrainedElementReorientCommand.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintCreateCommand.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintCreateCommandPCN.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DefaultNamedElementCreateCommand.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyBranchCreateCommand.java11
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyBranchReorientCommand.java24
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyCreateCommand.java11
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyNodeCreateCommand.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyReorientCommand.java24
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/GeneralizationCreateCommand.java13
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/GeneralizationReorientCommand.java8
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceCreateCommand.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceCreateCommandPCN.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceRealizationCreateCommand.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceRealizationReorientCommand.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ManifestationCreateCommand.java11
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ManifestationReorientCommand.java24
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ModelCreateCommand.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ModelCreateCommandCN.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/OperationForInterfaceCreateCommand.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PackageCreateCommand.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PackageCreateCommandCN.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PortCreateCommand.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PropertyCreateCommand.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PropertyForInterfaceCreateCommand.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ReceptionInInterfaceCreateCommand.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/RectangleInterfaceCreateCommand.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/SubstitutionCreateCommand.java11
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/SubstitutionReorientCommand.java24
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/UsageCreateCommand.java11
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/UsageReorientCommand.java24
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/AbstractionAppliedStereotypeEditPart.java1617
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/AbstractionEditPart.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/AbstractionNameEditPart.java1617
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/CommentBodyEditPart.java100
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/CommentBodyEditPartPCN.java100
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/CommentEditPart.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/CommentEditPartPCN.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentCompositeCompartmentEditPart.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentCompositeCompartmentEditPartCN.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentCompositeCompartmentEditPartPCN.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentDiagramEditPart.java7
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentEditPart.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentEditPartCN.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentEditPartPCN.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentNameEditPart.java100
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentNameEditPartCN.java100
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentNameEditPartPCN.java100
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentRealizationAppliedStereotypeEditPart.java1602
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentRealizationEditPart.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentRealizationNameEditPart.java1617
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConnectorAppliedStereotypeEditPart.java1617
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConnectorEditPart.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConnectorNameEditPart.java1617
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintEditPart.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintEditPartPCN.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintNameEditPart.java100
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintNameEditPartPCN.java100
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintSpecificationEditPart.java100
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintSpecificationEditPartPCN.java100
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DefaultNamedElementEditPart.java3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DefaultNamedElementNameEditPart.java100
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DependencyAppliedStereotypeEditPart.java1602
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DependencyEditPart.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DependencyNameEditPart.java1617
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DependencyNodeEditPart.java7
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/GeneralizationAppliedStereotypeEditPart.java1602
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/GeneralizationEditPart.java3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceAttributeCompartmentEditPart.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceAttributeCompartmentEditPartCN.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceEditPart.java7
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceEditPartPCN.java7
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceNameEditPart.java99
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceNameEditPartPCN.java99
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceOperationCompartmentEditPart.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceOperationCompartmentEditPartCN.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ManifestationAppliedStereotypeEditPart.java1617
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ManifestationEditPart.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ManifestationNameEditPart.java1617
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelEditPart.java5
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelEditPartCN.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelNameEditPart.java100
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelNameEditPartCN.java100
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelPackageableElementCompartmentEditPart.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelPackageableElementCompartmentEditPartCN.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/MultiDependencyLabelEditPart.java99
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/OperationForInterfaceEditPart.java95
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackageEditPart.java5
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackageEditPartCN.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackageNameEditPart.java100
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackageNameEditPartCN.java100
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackagePackageableElementCompartmentEditPart.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackagePackageableElementCompartmentEditPartCN.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PortAppliedStereotypeEditPart.java98
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PortEditPart.java8
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PortNameEditPart.java102
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PropertyForInterfaceEditPart.java95
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PropertyPartEditPartCN.java15
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PropertyPartNameEditPartCN.java100
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ReceptionInInterfaceEditPart.java95
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/RectangleInterfaceEditPart.java5
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/RectangleInterfaceEditPartCN.java5
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/RectangleInterfaceNameEditPart.java100
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/RectangleInterfaceNameEditPartCN.java100
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/SubstitutionAppliedStereotypeEditPart.java1617
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/SubstitutionEditPart.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/SubstitutionNameEditPart.java1617
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/UMLEditPartFactory.java107
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/AbstractionItemSemanticEditPolicy.java55
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/CommentItemSemanticEditPolicy.java13
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/CommentItemSemanticEditPolicyPCN.java13
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCanonicalEditPolicy.java9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCanonicalEditPolicyCN.java9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCanonicalEditPolicyPCN.java9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentCanonicalEditPolicy.java9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentCanonicalEditPolicyCN.java9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentCanonicalEditPolicyPCN.java9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicy.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicyCN.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicyPCN.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentDiagramItemSemanticEditPolicy.java20
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicy.java65
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicyCN.java65
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicyPCN.java65
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentRealizationItemSemanticEditPolicy.java55
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ConnectorItemSemanticEditPolicy.java55
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ConstraintItemSemanticEditPolicy.java58
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ConstraintItemSemanticEditPolicyPCN.java58
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/DefaultNamedElementItemSemanticEditPolicy.java56
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/DependencyBranchItemSemanticEditPolicy.java55
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/DependencyItemSemanticEditPolicy.java55
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/DependencyNodeItemSemanticEditPolicy.java55
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/GeneralizationItemSemanticEditPolicy.java10
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentCanonicalEditPolicy.java9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentCanonicalEditPolicyCN.java9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicy.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicyCN.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceItemSemanticEditPolicy.java80
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceItemSemanticEditPolicyPCN.java64
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentCanonicalEditPolicy.java9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentCanonicalEditPolicyCN.java9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicy.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicyCN.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceRealizationItemSemanticEditPolicy.java55
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ManifestationItemSemanticEditPolicy.java55
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelCanonicalEditPolicy.java108
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelItemSemanticEditPolicy.java98
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelItemSemanticEditPolicyCN.java98
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicy.java9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicyCN.java9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicy.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyCN.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/OperationForInterfaceItemSemanticEditPolicy.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackageItemSemanticEditPolicy.java55
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackageItemSemanticEditPolicyCN.java55
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicy.java9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicyCN.java9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicyCN.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PortItemSemanticEditPolicy.java55
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PropertyCanonicalEditPolicy.java9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PropertyForInterfaceItemSemanticEditPolicy.java1
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PropertyItemSemanticEditPolicy.java66
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ReceptionInInterfaceItemSemanticEditPolicy.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/RectangleInterfaceItemSemanticEditPolicy.java80
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/SubstitutionItemSemanticEditPolicy.java58
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UMLBaseItemSemanticEditPolicy.java45
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UMLTextNonResizableEditPolicy.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UMLTextSelectionEditPolicy.java1
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UsageItemSemanticEditPolicy.java55
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/parsers/MessageFormatParser.java7
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/DiagramEditorContextMenuProvider.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLCreationWizard.java39
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLCreationWizardPage.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramEditor.java60
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramEditorPlugin.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramEditorUtil.java22
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramUpdateCommand.java1
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramUpdater.java1730
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDocumentProvider.java47
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLInitDiagramFileAction.java17
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLMatchingStrategy.java1
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLNewDiagramFileWizard.java58
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLPaletteFactory.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLVisualIDRegistry.java3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/ValidateAction.java78
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/preferences/DiagramPreferenceInitializer.java1
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/ElementInitializers.java1326
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLEditPartProvider.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLElementTypes.java67
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLMarkerNavigationProvider.java9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLParserProvider.java143
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLValidationDecoratorProvider.java9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLValidationProvider.java1
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLViewProvider.java213
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/sheet/UMLPropertySection.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/sheet/UMLSheetLabelProvider.java6
211 files changed, 17276 insertions, 13196 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/AbstractionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/AbstractionCreateCommand.java
index 5cc8f22cdef..714374aa449 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/AbstractionCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/AbstractionCreateCommand.java
@@ -91,14 +91,19 @@ public class AbstractionCreateCommand extends EditElementCommand {
if (!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
+
Abstraction newElement = UMLFactory.eINSTANCE.createAbstraction();
- getContainer().getPackagedElements().add(newElement);
- newElement.getClients().add(getSource());
- newElement.getSuppliers().add(getTarget());
+ getContainer().getPackagedElements()
+ .add(newElement);
+ newElement.getClients()
+ .add(getSource());
+ newElement.getSuppliers()
+ .add(getTarget());
ElementInitializers.getInstance().init_Abstraction_4013(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/AbstractionReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/AbstractionReorientCommand.java
index 34e72e187da..fe5ca967cfd 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/AbstractionReorientCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/AbstractionReorientCommand.java
@@ -78,10 +78,12 @@ public class AbstractionReorientCommand extends EditElementCommand {
if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
return false;
}
- if (getLink().getSuppliers().size() != 1) {
+ if (getLink().getSuppliers()
+ .size() != 1) {
return false;
}
- NamedElement target = getLink().getSuppliers().get(0);
+ NamedElement target = getLink().getSuppliers()
+ .get(0);
if (!(getLink().eContainer() instanceof Package)) {
return false;
}
@@ -96,10 +98,12 @@ public class AbstractionReorientCommand extends EditElementCommand {
if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
return false;
}
- if (getLink().getClients().size() != 1) {
+ if (getLink().getClients()
+ .size() != 1) {
return false;
}
- NamedElement source = getLink().getClients().get(0);
+ NamedElement source = getLink().getClients()
+ .get(0);
if (!(getLink().eContainer() instanceof Package)) {
return false;
}
@@ -128,8 +132,10 @@ public class AbstractionReorientCommand extends EditElementCommand {
* @generated
*/
protected CommandResult reorientSource() throws ExecutionException {
- getLink().getClients().remove(getOldSource());
- getLink().getClients().add(getNewSource());
+ getLink().getClients()
+ .remove(getOldSource());
+ getLink().getClients()
+ .add(getNewSource());
return CommandResult.newOKCommandResult(getLink());
}
@@ -137,8 +143,10 @@ public class AbstractionReorientCommand extends EditElementCommand {
* @generated
*/
protected CommandResult reorientTarget() throws ExecutionException {
- getLink().getSuppliers().remove(getOldTarget());
- getLink().getSuppliers().add(getNewTarget());
+ getLink().getSuppliers()
+ .remove(getOldTarget());
+ getLink().getSuppliers()
+ .add(getNewTarget());
return CommandResult.newOKCommandResult(getLink());
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentAnnotatedElementCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentAnnotatedElementCreateCommand.java
index 1248c18bdfc..d94ab0294e8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentAnnotatedElementCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentAnnotatedElementCreateCommand.java
@@ -75,10 +75,13 @@ public class CommentAnnotatedElementCreateCommand extends EditElementCommand {
if (!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
+
if (getSource() != null && getTarget() != null) {
- getSource().getAnnotatedElements().add(getTarget());
+ getSource().getAnnotatedElements()
+ .add(getTarget());
}
return CommandResult.newOKCommandResult();
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentAnnotatedElementReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentAnnotatedElementReorientCommand.java
index b2ff1296e6a..2894e0e0775 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentAnnotatedElementReorientCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentAnnotatedElementReorientCommand.java
@@ -117,8 +117,10 @@ public class CommentAnnotatedElementReorientCommand extends EditElementCommand {
* @generated
*/
protected CommandResult reorientSource() throws ExecutionException {
- getOldSource().getAnnotatedElements().remove(getOldTarget());
- getNewSource().getAnnotatedElements().add(getOldTarget());
+ getOldSource().getAnnotatedElements()
+ .remove(getOldTarget());
+ getNewSource().getAnnotatedElements()
+ .add(getOldTarget());
return CommandResult.newOKCommandResult(referenceOwner);
}
@@ -126,8 +128,10 @@ public class CommentAnnotatedElementReorientCommand extends EditElementCommand {
* @generated
*/
protected CommandResult reorientTarget() throws ExecutionException {
- getOldSource().getAnnotatedElements().remove(getOldTarget());
- getOldSource().getAnnotatedElements().add(getNewTarget());
+ getOldSource().getAnnotatedElements()
+ .remove(getOldTarget());
+ getOldSource().getAnnotatedElements()
+ .add(getNewTarget());
return CommandResult.newOKCommandResult(referenceOwner);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentCreateCommand.java
index 7f75245222f..8c30290d952 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentCreateCommand.java
@@ -68,9 +68,12 @@ public class CommentCreateCommand extends EditElementCommand {
*/
@Override
public boolean canExecute() {
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComment());
return data.isPermitted();
+
+
}
/**
@@ -78,7 +81,9 @@ public class CommentCreateCommand extends EditElementCommand {
*/
@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()) {
@@ -87,14 +92,21 @@ public class CommentCreateCommand extends EditElementCommand {
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);
+ qualifiedTarget.getOwnedComments()
+ .add(newElement);
+
}
} else {
return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
}
+
+
ElementInitializers.getInstance().init_Comment_3201(newElement);
+
doConfigure(newElement, monitor, info);
+
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentCreateCommandPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentCreateCommandPCN.java
index cbbfe711555..3c72136c021 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentCreateCommandPCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentCreateCommandPCN.java
@@ -68,9 +68,12 @@ public class CommentCreateCommandPCN extends EditElementCommand {
*/
@Override
public boolean canExecute() {
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComment());
return data.isPermitted();
+
+
}
/**
@@ -78,7 +81,9 @@ public class CommentCreateCommandPCN extends EditElementCommand {
*/
@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()) {
@@ -87,14 +92,21 @@ public class CommentCreateCommandPCN extends EditElementCommand {
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);
+ qualifiedTarget.getOwnedComments()
+ .add(newElement);
+
}
} else {
return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
}
+
+
ElementInitializers.getInstance().init_Comment_3074(newElement);
+
doConfigure(newElement, monitor, info);
+
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommand.java
index 60cc9a582c9..5755d69c9da 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommand.java
@@ -68,9 +68,12 @@ public class ComponentCreateCommand extends EditElementCommand {
*/
@Override
public boolean canExecute() {
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComponent());
return data.isPermitted();
+
+
}
/**
@@ -78,7 +81,9 @@ public class ComponentCreateCommand extends EditElementCommand {
*/
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
Component newElement = UMLFactory.eINSTANCE.createComponent();
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
if (data.isPermitted()) {
@@ -87,14 +92,21 @@ public class ComponentCreateCommand extends EditElementCommand {
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);
+ qualifiedTarget.getPackagedElements()
+ .add(newElement);
+
}
} else {
return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
}
+
+
ElementInitializers.getInstance().init_Component_2002(newElement);
+
doConfigure(newElement, monitor, info);
+
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommandCN.java
index 9dd1bce81e4..b7473c8a810 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommandCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommandCN.java
@@ -67,9 +67,12 @@ public class ComponentCreateCommandCN extends EditElementCommand {
*/
@Override
public boolean canExecute() {
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComponent());
return data.isPermitted();
+
+
}
/**
@@ -77,7 +80,9 @@ public class ComponentCreateCommandCN extends EditElementCommand {
*/
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
Component newElement = UMLFactory.eINSTANCE.createComponent();
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
if (data.isPermitted()) {
@@ -86,14 +91,21 @@ public class ComponentCreateCommandCN extends EditElementCommand {
return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
}
} else {
+
Component qualifiedTarget = (Component) target;
- qualifiedTarget.getPackagedElements().add(newElement);
+ qualifiedTarget.getPackagedElements()
+ .add(newElement);
+
}
} else {
return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
}
+
+
ElementInitializers.getInstance().init_Component_3070(newElement);
+
doConfigure(newElement, monitor, info);
+
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommandPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommandPCN.java
index 701cdd2a6d7..4462603de49 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommandPCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommandPCN.java
@@ -68,9 +68,12 @@ public class ComponentCreateCommandPCN extends EditElementCommand {
*/
@Override
public boolean canExecute() {
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComponent());
return data.isPermitted();
+
+
}
/**
@@ -78,7 +81,9 @@ public class ComponentCreateCommandPCN extends EditElementCommand {
*/
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
Component newElement = UMLFactory.eINSTANCE.createComponent();
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
if (data.isPermitted()) {
@@ -87,14 +92,21 @@ public class ComponentCreateCommandPCN extends EditElementCommand {
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);
+ qualifiedTarget.getPackagedElements()
+ .add(newElement);
+
}
} else {
return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
}
+
+
ElementInitializers.getInstance().init_Component_3071(newElement);
+
doConfigure(newElement, monitor, info);
+
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentRealizationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentRealizationCreateCommand.java
index aa899b5a530..c5d070a162e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentRealizationCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentRealizationCreateCommand.java
@@ -91,14 +91,19 @@ public class ComponentRealizationCreateCommand extends EditElementCommand {
if (!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
+
ComponentRealization newElement = UMLFactory.eINSTANCE.createComponentRealization();
- getContainer().getPackagedElements().add(newElement);
- newElement.getClients().add(getSource());
- newElement.getSuppliers().add(getTarget());
+ getContainer().getPackagedElements()
+ .add(newElement);
+ newElement.getClients()
+ .add(getSource());
+ newElement.getSuppliers()
+ .add(getTarget());
ElementInitializers.getInstance().init_ComponentRealization_4007(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentRealizationReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentRealizationReorientCommand.java
index 51fae368103..9fed05cf1c7 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentRealizationReorientCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentRealizationReorientCommand.java
@@ -78,10 +78,12 @@ public class ComponentRealizationReorientCommand extends EditElementCommand {
if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
return false;
}
- if (getLink().getSuppliers().size() != 1) {
+ if (getLink().getSuppliers()
+ .size() != 1) {
return false;
}
- NamedElement target = getLink().getSuppliers().get(0);
+ NamedElement target = getLink().getSuppliers()
+ .get(0);
if (!(getLink().eContainer() instanceof Package)) {
return false;
}
@@ -96,10 +98,12 @@ public class ComponentRealizationReorientCommand extends EditElementCommand {
if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
return false;
}
- if (getLink().getClients().size() != 1) {
+ if (getLink().getClients()
+ .size() != 1) {
return false;
}
- NamedElement source = getLink().getClients().get(0);
+ NamedElement source = getLink().getClients()
+ .get(0);
if (!(getLink().eContainer() instanceof Package)) {
return false;
}
@@ -128,8 +132,10 @@ public class ComponentRealizationReorientCommand extends EditElementCommand {
* @generated
*/
protected CommandResult reorientSource() throws ExecutionException {
- getLink().getClients().remove(getOldSource());
- getLink().getClients().add(getNewSource());
+ getLink().getClients()
+ .remove(getOldSource());
+ getLink().getClients()
+ .add(getNewSource());
return CommandResult.newOKCommandResult(getLink());
}
@@ -137,8 +143,10 @@ public class ComponentRealizationReorientCommand extends EditElementCommand {
* @generated
*/
protected CommandResult reorientTarget() throws ExecutionException {
- getLink().getSuppliers().remove(getOldTarget());
- getLink().getSuppliers().add(getNewTarget());
+ getLink().getSuppliers()
+ .remove(getOldTarget());
+ getLink().getSuppliers()
+ .add(getNewTarget());
return CommandResult.newOKCommandResult(getLink());
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConnectorCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConnectorCreateCommand.java
index b6d28234b2f..c78ee724519 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConnectorCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConnectorCreateCommand.java
@@ -91,14 +91,19 @@ public class ConnectorCreateCommand extends EditElementCommand {
if (!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
+
Connector newElement = UMLFactory.eINSTANCE.createConnector();
- getContainer().getOwnedConnectors().add(newElement);
- newElement.getEnds().add(getSource());
- newElement.getEnds().add(getTarget());
+ getContainer().getOwnedConnectors()
+ .add(newElement);
+ newElement.getEnds()
+ .add(getSource());
+ newElement.getEnds()
+ .add(getTarget());
ElementInitializers.getInstance().init_Connector_4019(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConnectorReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConnectorReorientCommand.java
index 271138d28ac..2e7f2c5748a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConnectorReorientCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConnectorReorientCommand.java
@@ -78,10 +78,12 @@ public class ConnectorReorientCommand extends EditElementCommand {
if (!(oldEnd instanceof ConnectorEnd && newEnd instanceof ConnectorEnd)) {
return false;
}
- if (getLink().getEnds().size() != 1) {
+ if (getLink().getEnds()
+ .size() != 1) {
return false;
}
- ConnectorEnd target = getLink().getEnds().get(0);
+ ConnectorEnd target = getLink().getEnds()
+ .get(0);
if (!(getLink().eContainer() instanceof StructuredClassifier)) {
return false;
}
@@ -96,10 +98,12 @@ public class ConnectorReorientCommand extends EditElementCommand {
if (!(oldEnd instanceof ConnectorEnd && newEnd instanceof ConnectorEnd)) {
return false;
}
- if (getLink().getEnds().size() != 1) {
+ if (getLink().getEnds()
+ .size() != 1) {
return false;
}
- ConnectorEnd source = getLink().getEnds().get(0);
+ ConnectorEnd source = getLink().getEnds()
+ .get(0);
if (!(getLink().eContainer() instanceof StructuredClassifier)) {
return false;
}
@@ -128,8 +132,10 @@ public class ConnectorReorientCommand extends EditElementCommand {
* @generated
*/
protected CommandResult reorientSource() throws ExecutionException {
- getLink().getEnds().remove(getOldSource());
- getLink().getEnds().add(getNewSource());
+ getLink().getEnds()
+ .remove(getOldSource());
+ getLink().getEnds()
+ .add(getNewSource());
return CommandResult.newOKCommandResult(getLink());
}
@@ -137,8 +143,10 @@ public class ConnectorReorientCommand extends EditElementCommand {
* @generated
*/
protected CommandResult reorientTarget() throws ExecutionException {
- getLink().getEnds().remove(getOldTarget());
- getLink().getEnds().add(getNewTarget());
+ getLink().getEnds()
+ .remove(getOldTarget());
+ getLink().getEnds()
+ .add(getNewTarget());
return CommandResult.newOKCommandResult(getLink());
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintConstrainedElementCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintConstrainedElementCreateCommand.java
index 22263ec343f..21b06be5693 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintConstrainedElementCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintConstrainedElementCreateCommand.java
@@ -75,10 +75,13 @@ public class ConstraintConstrainedElementCreateCommand extends EditElementComman
if (!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
+
if (getSource() != null && getTarget() != null) {
- getSource().getConstrainedElements().add(getTarget());
+ getSource().getConstrainedElements()
+ .add(getTarget());
}
return CommandResult.newOKCommandResult();
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintConstrainedElementReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintConstrainedElementReorientCommand.java
index 8255ffb3366..8cdb7a2d32f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintConstrainedElementReorientCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintConstrainedElementReorientCommand.java
@@ -117,8 +117,10 @@ public class ConstraintConstrainedElementReorientCommand extends EditElementComm
* @generated
*/
protected CommandResult reorientSource() throws ExecutionException {
- getOldSource().getConstrainedElements().remove(getOldTarget());
- getNewSource().getConstrainedElements().add(getOldTarget());
+ getOldSource().getConstrainedElements()
+ .remove(getOldTarget());
+ getNewSource().getConstrainedElements()
+ .add(getOldTarget());
return CommandResult.newOKCommandResult(referenceOwner);
}
@@ -126,8 +128,10 @@ public class ConstraintConstrainedElementReorientCommand extends EditElementComm
* @generated
*/
protected CommandResult reorientTarget() throws ExecutionException {
- getOldSource().getConstrainedElements().remove(getOldTarget());
- getOldSource().getConstrainedElements().add(getNewTarget());
+ getOldSource().getConstrainedElements()
+ .remove(getOldTarget());
+ getOldSource().getConstrainedElements()
+ .add(getNewTarget());
return CommandResult.newOKCommandResult(referenceOwner);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintCreateCommand.java
index 40959e64a70..9d96a603283 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintCreateCommand.java
@@ -68,9 +68,12 @@ public class ConstraintCreateCommand extends EditElementCommand {
*/
@Override
public boolean canExecute() {
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getConstraint());
return data.isPermitted();
+
+
}
/**
@@ -78,7 +81,9 @@ public class ConstraintCreateCommand extends EditElementCommand {
*/
@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()) {
@@ -87,14 +92,21 @@ public class ConstraintCreateCommand extends EditElementCommand {
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);
+ qualifiedTarget.getOwnedRules()
+ .add(newElement);
+
}
} else {
return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
}
+
+
ElementInitializers.getInstance().init_Constraint_3199(newElement);
+
doConfigure(newElement, monitor, info);
+
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintCreateCommandPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintCreateCommandPCN.java
index 887c8cf518d..501d4f05860 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintCreateCommandPCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintCreateCommandPCN.java
@@ -68,9 +68,12 @@ public class ConstraintCreateCommandPCN extends EditElementCommand {
*/
@Override
public boolean canExecute() {
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getConstraint());
return data.isPermitted();
+
+
}
/**
@@ -78,7 +81,9 @@ public class ConstraintCreateCommandPCN extends EditElementCommand {
*/
@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()) {
@@ -87,14 +92,21 @@ public class ConstraintCreateCommandPCN extends EditElementCommand {
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);
+ qualifiedTarget.getOwnedRules()
+ .add(newElement);
+
}
} else {
return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
}
+
+
ElementInitializers.getInstance().init_Constraint_3075(newElement);
+
doConfigure(newElement, monitor, info);
+
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DefaultNamedElementCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DefaultNamedElementCreateCommand.java
index b309eb4fe68..731766637c5 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DefaultNamedElementCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DefaultNamedElementCreateCommand.java
@@ -65,9 +65,12 @@ public class DefaultNamedElementCreateCommand extends EditElementCommand {
*/
@Override
public boolean canExecute() {
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getNamedElement());
return data.isPermitted();
+
+
}
/**
@@ -75,6 +78,7 @@ public class DefaultNamedElementCreateCommand extends EditElementCommand {
*/
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
throw new UnsupportedOperationException("Unimplemented operation (abstract domain element).");
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyBranchCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyBranchCreateCommand.java
index 135f2f056ea..89628fcaa2d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyBranchCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyBranchCreateCommand.java
@@ -91,14 +91,19 @@ public class DependencyBranchCreateCommand extends EditElementCommand {
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());
+ getContainer().getPackagedElements()
+ .add(newElement);
+ newElement.getClients()
+ .add(getSource());
+ newElement.getSuppliers()
+ .add(getTarget());
ElementInitializers.getInstance().init_Dependency_4017(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyBranchReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyBranchReorientCommand.java
index 16e57cab2e6..2586861c178 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyBranchReorientCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyBranchReorientCommand.java
@@ -78,10 +78,12 @@ public class DependencyBranchReorientCommand extends EditElementCommand {
if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
return false;
}
- if (getLink().getSuppliers().size() != 1) {
+ if (getLink().getSuppliers()
+ .size() != 1) {
return false;
}
- NamedElement target = getLink().getSuppliers().get(0);
+ NamedElement target = getLink().getSuppliers()
+ .get(0);
if (!(getLink().eContainer() instanceof Package)) {
return false;
}
@@ -96,10 +98,12 @@ public class DependencyBranchReorientCommand extends EditElementCommand {
if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
return false;
}
- if (getLink().getClients().size() != 1) {
+ if (getLink().getClients()
+ .size() != 1) {
return false;
}
- NamedElement source = getLink().getClients().get(0);
+ NamedElement source = getLink().getClients()
+ .get(0);
if (!(getLink().eContainer() instanceof Package)) {
return false;
}
@@ -128,8 +132,10 @@ public class DependencyBranchReorientCommand extends EditElementCommand {
* @generated
*/
protected CommandResult reorientSource() throws ExecutionException {
- getLink().getClients().remove(getOldSource());
- getLink().getClients().add(getNewSource());
+ getLink().getClients()
+ .remove(getOldSource());
+ getLink().getClients()
+ .add(getNewSource());
return CommandResult.newOKCommandResult(getLink());
}
@@ -137,8 +143,10 @@ public class DependencyBranchReorientCommand extends EditElementCommand {
* @generated
*/
protected CommandResult reorientTarget() throws ExecutionException {
- getLink().getSuppliers().remove(getOldTarget());
- getLink().getSuppliers().add(getNewTarget());
+ getLink().getSuppliers()
+ .remove(getOldTarget());
+ getLink().getSuppliers()
+ .add(getNewTarget());
return CommandResult.newOKCommandResult(getLink());
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyCreateCommand.java
index cfc48f9e53b..25b21e52771 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyCreateCommand.java
@@ -91,14 +91,19 @@ public class DependencyCreateCommand extends EditElementCommand {
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());
+ 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);
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyNodeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyNodeCreateCommand.java
index f73130bba06..bf96f1d077a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyNodeCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyNodeCreateCommand.java
@@ -67,9 +67,12 @@ public class DependencyNodeCreateCommand extends EditElementCommand {
*/
@Override
public boolean canExecute() {
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDependency());
return data.isPermitted();
+
+
}
/**
@@ -77,7 +80,9 @@ public class DependencyNodeCreateCommand extends EditElementCommand {
*/
@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()) {
@@ -86,13 +91,20 @@ public class DependencyNodeCreateCommand extends EditElementCommand {
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);
+ 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);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyReorientCommand.java
index 16573c7820c..9def2e1c8cf 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyReorientCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyReorientCommand.java
@@ -78,10 +78,12 @@ public class DependencyReorientCommand extends EditElementCommand {
if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
return false;
}
- if (getLink().getSuppliers().size() != 1) {
+ if (getLink().getSuppliers()
+ .size() != 1) {
return false;
}
- NamedElement target = getLink().getSuppliers().get(0);
+ NamedElement target = getLink().getSuppliers()
+ .get(0);
if (!(getLink().eContainer() instanceof Package)) {
return false;
}
@@ -96,10 +98,12 @@ public class DependencyReorientCommand extends EditElementCommand {
if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
return false;
}
- if (getLink().getClients().size() != 1) {
+ if (getLink().getClients()
+ .size() != 1) {
return false;
}
- NamedElement source = getLink().getClients().get(0);
+ NamedElement source = getLink().getClients()
+ .get(0);
if (!(getLink().eContainer() instanceof Package)) {
return false;
}
@@ -128,8 +132,10 @@ public class DependencyReorientCommand extends EditElementCommand {
* @generated
*/
protected CommandResult reorientSource() throws ExecutionException {
- getLink().getClients().remove(getOldSource());
- getLink().getClients().add(getNewSource());
+ getLink().getClients()
+ .remove(getOldSource());
+ getLink().getClients()
+ .add(getNewSource());
return CommandResult.newOKCommandResult(getLink());
}
@@ -137,8 +143,10 @@ public class DependencyReorientCommand extends EditElementCommand {
* @generated
*/
protected CommandResult reorientTarget() throws ExecutionException {
- getLink().getSuppliers().remove(getOldTarget());
- getLink().getSuppliers().add(getNewTarget());
+ getLink().getSuppliers()
+ .remove(getOldTarget());
+ getLink().getSuppliers()
+ .add(getNewTarget());
return CommandResult.newOKCommandResult(getLink());
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/GeneralizationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/GeneralizationCreateCommand.java
index 4c5fdc31e16..3cb2d2877ba 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/GeneralizationCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/GeneralizationCreateCommand.java
@@ -89,13 +89,20 @@ public class GeneralizationCreateCommand extends EditElementCommand {
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());
+ getContainer().getGeneralizations()
+ .add(newElement);
+ newElement.setSpecific(
+ getSource()
+ );
+ newElement.setGeneral(
+ getTarget()
+ );
doConfigure(newElement, monitor, info);
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/GeneralizationReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/GeneralizationReorientCommand.java
index 9dbdc3e894b..efd06b815d0 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/GeneralizationReorientCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/GeneralizationReorientCommand.java
@@ -121,7 +121,9 @@ public class GeneralizationReorientCommand extends EditElementCommand {
* @generated
*/
protected CommandResult reorientSource() throws ExecutionException {
- getLink().setSpecific(getNewSource());
+ getLink().setSpecific(
+ getNewSource()
+ );
return CommandResult.newOKCommandResult(getLink());
}
@@ -129,7 +131,9 @@ public class GeneralizationReorientCommand extends EditElementCommand {
* @generated
*/
protected CommandResult reorientTarget() throws ExecutionException {
- getLink().setGeneral(getNewTarget());
+ getLink().setGeneral(
+ getNewTarget()
+ );
return CommandResult.newOKCommandResult(getLink());
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceCreateCommand.java
index ab34ec8f29e..43eb4ba6b86 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceCreateCommand.java
@@ -68,9 +68,12 @@ public class InterfaceCreateCommand extends EditElementCommand {
*/
@Override
public boolean canExecute() {
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInterface());
return data.isPermitted();
+
+
}
/**
@@ -78,7 +81,9 @@ public class InterfaceCreateCommand extends EditElementCommand {
*/
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
Interface newElement = UMLFactory.eINSTANCE.createInterface();
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
if (data.isPermitted()) {
@@ -87,14 +92,21 @@ public class InterfaceCreateCommand extends EditElementCommand {
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);
+ qualifiedTarget.getPackagedElements()
+ .add(newElement);
+
}
} else {
return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
}
+
+
ElementInitializers.getInstance().init_Interface_3078(newElement);
+
doConfigure(newElement, monitor, info);
+
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceCreateCommandPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceCreateCommandPCN.java
index 51310e450ad..f15973419f1 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceCreateCommandPCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceCreateCommandPCN.java
@@ -68,9 +68,12 @@ public class InterfaceCreateCommandPCN extends EditElementCommand {
*/
@Override
public boolean canExecute() {
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInterface());
return data.isPermitted();
+
+
}
/**
@@ -78,7 +81,9 @@ public class InterfaceCreateCommandPCN extends EditElementCommand {
*/
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
Interface newElement = UMLFactory.eINSTANCE.createInterface();
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
if (data.isPermitted()) {
@@ -87,14 +92,21 @@ public class InterfaceCreateCommandPCN extends EditElementCommand {
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);
+ qualifiedTarget.getPackagedElements()
+ .add(newElement);
+
}
} else {
return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
}
+
+
ElementInitializers.getInstance().init_Interface_3072(newElement);
+
doConfigure(newElement, monitor, info);
+
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceRealizationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceRealizationCreateCommand.java
index e23eea7d2f3..3eba4211ca5 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceRealizationCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceRealizationCreateCommand.java
@@ -92,14 +92,20 @@ public class InterfaceRealizationCreateCommand extends EditElementCommand {
if (!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
+
InterfaceRealization newElement = UMLFactory.eINSTANCE.createInterfaceRealization();
- getContainer().getPackagedElements().add(newElement);
- newElement.getClients().add(getSource());
- newElement.setContract(getTarget());
+ getContainer().getPackagedElements()
+ .add(newElement);
+ newElement.getClients()
+ .add(getSource());
+ newElement.setContract(
+ getTarget()
+ );
ElementInitializers.getInstance().init_InterfaceRealization_4006(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceRealizationReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceRealizationReorientCommand.java
index 91b761d3e75..80896f8acf8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceRealizationReorientCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceRealizationReorientCommand.java
@@ -94,10 +94,12 @@ public class InterfaceRealizationReorientCommand extends EditElementCommand {
if (!(oldEnd instanceof Interface && newEnd instanceof Interface)) {
return false;
}
- if (getLink().getClients().size() != 1) {
+ if (getLink().getClients()
+ .size() != 1) {
return false;
}
- NamedElement source = getLink().getClients().get(0);
+ NamedElement source = getLink().getClients()
+ .get(0);
if (!(getLink().eContainer() instanceof Package)) {
return false;
}
@@ -126,8 +128,10 @@ public class InterfaceRealizationReorientCommand extends EditElementCommand {
* @generated
*/
protected CommandResult reorientSource() throws ExecutionException {
- getLink().getClients().remove(getOldSource());
- getLink().getClients().add(getNewSource());
+ getLink().getClients()
+ .remove(getOldSource());
+ getLink().getClients()
+ .add(getNewSource());
return CommandResult.newOKCommandResult(getLink());
}
@@ -135,7 +139,9 @@ public class InterfaceRealizationReorientCommand extends EditElementCommand {
* @generated
*/
protected CommandResult reorientTarget() throws ExecutionException {
- getLink().setContract(getNewTarget());
+ getLink().setContract(
+ getNewTarget()
+ );
return CommandResult.newOKCommandResult(getLink());
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ManifestationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ManifestationCreateCommand.java
index f7dc9d6487b..12963037cf6 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ManifestationCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ManifestationCreateCommand.java
@@ -91,14 +91,19 @@ public class ManifestationCreateCommand extends EditElementCommand {
if (!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
+
Manifestation newElement = UMLFactory.eINSTANCE.createManifestation();
- getContainer().getPackagedElements().add(newElement);
- newElement.getClients().add(getSource());
- newElement.getSuppliers().add(getTarget());
+ getContainer().getPackagedElements()
+ .add(newElement);
+ newElement.getClients()
+ .add(getSource());
+ newElement.getSuppliers()
+ .add(getTarget());
ElementInitializers.getInstance().init_Manifestation_4014(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ManifestationReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ManifestationReorientCommand.java
index e82fd01e3cb..518256ac29e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ManifestationReorientCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ManifestationReorientCommand.java
@@ -78,10 +78,12 @@ public class ManifestationReorientCommand extends EditElementCommand {
if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
return false;
}
- if (getLink().getSuppliers().size() != 1) {
+ if (getLink().getSuppliers()
+ .size() != 1) {
return false;
}
- NamedElement target = getLink().getSuppliers().get(0);
+ NamedElement target = getLink().getSuppliers()
+ .get(0);
if (!(getLink().eContainer() instanceof Package)) {
return false;
}
@@ -96,10 +98,12 @@ public class ManifestationReorientCommand extends EditElementCommand {
if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
return false;
}
- if (getLink().getClients().size() != 1) {
+ if (getLink().getClients()
+ .size() != 1) {
return false;
}
- NamedElement source = getLink().getClients().get(0);
+ NamedElement source = getLink().getClients()
+ .get(0);
if (!(getLink().eContainer() instanceof Package)) {
return false;
}
@@ -128,8 +132,10 @@ public class ManifestationReorientCommand extends EditElementCommand {
* @generated
*/
protected CommandResult reorientSource() throws ExecutionException {
- getLink().getClients().remove(getOldSource());
- getLink().getClients().add(getNewSource());
+ getLink().getClients()
+ .remove(getOldSource());
+ getLink().getClients()
+ .add(getNewSource());
return CommandResult.newOKCommandResult(getLink());
}
@@ -137,8 +143,10 @@ public class ManifestationReorientCommand extends EditElementCommand {
* @generated
*/
protected CommandResult reorientTarget() throws ExecutionException {
- getLink().getSuppliers().remove(getOldTarget());
- getLink().getSuppliers().add(getNewTarget());
+ getLink().getSuppliers()
+ .remove(getOldTarget());
+ getLink().getSuppliers()
+ .add(getNewTarget());
return CommandResult.newOKCommandResult(getLink());
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ModelCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ModelCreateCommand.java
index b600c22f929..079a00e0f44 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ModelCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ModelCreateCommand.java
@@ -68,9 +68,12 @@ public class ModelCreateCommand extends EditElementCommand {
*/
@Override
public boolean canExecute() {
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getModel());
return data.isPermitted();
+
+
}
/**
@@ -78,7 +81,9 @@ public class ModelCreateCommand extends EditElementCommand {
*/
@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()) {
@@ -87,14 +92,21 @@ public class ModelCreateCommand extends EditElementCommand {
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);
+ qualifiedTarget.getPackagedElements()
+ .add(newElement);
+
}
} else {
return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
}
+
+
ElementInitializers.getInstance().init_Model_3202(newElement);
+
doConfigure(newElement, monitor, info);
+
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ModelCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ModelCreateCommandCN.java
index ee217961e2f..12097649cdb 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ModelCreateCommandCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ModelCreateCommandCN.java
@@ -68,9 +68,12 @@ public class ModelCreateCommandCN extends EditElementCommand {
*/
@Override
public boolean canExecute() {
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getModel());
return data.isPermitted();
+
+
}
/**
@@ -78,7 +81,9 @@ public class ModelCreateCommandCN extends EditElementCommand {
*/
@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()) {
@@ -87,14 +92,21 @@ public class ModelCreateCommandCN extends EditElementCommand {
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);
+ qualifiedTarget.getPackagedElements()
+ .add(newElement);
+
}
} else {
return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
}
+
+
ElementInitializers.getInstance().init_Model_3077(newElement);
+
doConfigure(newElement, monitor, info);
+
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/OperationForInterfaceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/OperationForInterfaceCreateCommand.java
index b9b5e37fefb..ce860519451 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/OperationForInterfaceCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/OperationForInterfaceCreateCommand.java
@@ -68,9 +68,12 @@ public class OperationForInterfaceCreateCommand extends EditElementCommand {
*/
@Override
public boolean canExecute() {
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOperation());
return data.isPermitted();
+
+
}
/**
@@ -78,7 +81,9 @@ public class OperationForInterfaceCreateCommand extends EditElementCommand {
*/
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
Operation newElement = UMLFactory.eINSTANCE.createOperation();
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
if (data.isPermitted()) {
@@ -87,14 +92,21 @@ public class OperationForInterfaceCreateCommand extends EditElementCommand {
return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
}
} else {
+
Interface qualifiedTarget = (Interface) target;
- qualifiedTarget.getOwnedOperations().add(newElement);
+ qualifiedTarget.getOwnedOperations()
+ .add(newElement);
+
}
} else {
return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
}
+
+
ElementInitializers.getInstance().init_Operation_5(newElement);
+
doConfigure(newElement, monitor, info);
+
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PackageCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PackageCreateCommand.java
index 8bae23c29c9..a20fd3f818d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PackageCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PackageCreateCommand.java
@@ -67,9 +67,12 @@ public class PackageCreateCommand extends EditElementCommand {
*/
@Override
public boolean canExecute() {
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPackage());
return data.isPermitted();
+
+
}
/**
@@ -77,7 +80,9 @@ public class PackageCreateCommand extends EditElementCommand {
*/
@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()) {
@@ -86,14 +91,21 @@ public class PackageCreateCommand extends EditElementCommand {
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);
+ qualifiedTarget.getPackagedElements()
+ .add(newElement);
+
}
} else {
return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
}
+
+
ElementInitializers.getInstance().init_Package_3200(newElement);
+
doConfigure(newElement, monitor, info);
+
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PackageCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PackageCreateCommandCN.java
index 4c47ef2dcae..b104f7b69a4 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PackageCreateCommandCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PackageCreateCommandCN.java
@@ -67,9 +67,12 @@ public class PackageCreateCommandCN extends EditElementCommand {
*/
@Override
public boolean canExecute() {
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPackage());
return data.isPermitted();
+
+
}
/**
@@ -77,7 +80,9 @@ public class PackageCreateCommandCN extends EditElementCommand {
*/
@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()) {
@@ -86,14 +91,21 @@ public class PackageCreateCommandCN extends EditElementCommand {
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);
+ qualifiedTarget.getPackagedElements()
+ .add(newElement);
+
}
} else {
return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
}
+
+
ElementInitializers.getInstance().init_Package_3076(newElement);
+
doConfigure(newElement, monitor, info);
+
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PortCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PortCreateCommand.java
index 33b82678117..c8c6e4fa01d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PortCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PortCreateCommand.java
@@ -68,9 +68,12 @@ public class PortCreateCommand extends EditElementCommand {
*/
@Override
public boolean canExecute() {
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPort());
return data.isPermitted();
+
+
}
/**
@@ -78,7 +81,9 @@ public class PortCreateCommand extends EditElementCommand {
*/
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
Port newElement = UMLFactory.eINSTANCE.createPort();
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
if (data.isPermitted()) {
@@ -87,14 +92,21 @@ public class PortCreateCommand extends EditElementCommand {
return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
}
} else {
+
StructuredClassifier qualifiedTarget = (StructuredClassifier) target;
- qualifiedTarget.getOwnedAttributes().add(newElement);
+ qualifiedTarget.getOwnedAttributes()
+ .add(newElement);
+
}
} else {
return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
}
+
+
ElementInitializers.getInstance().init_Port_3069(newElement);
+
doConfigure(newElement, monitor, info);
+
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PropertyCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PropertyCreateCommand.java
index 74c430905f9..8a4e3a82a28 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PropertyCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PropertyCreateCommand.java
@@ -68,9 +68,12 @@ public class PropertyCreateCommand extends EditElementCommand {
*/
@Override
public boolean canExecute() {
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getProperty());
return data.isPermitted();
+
+
}
/**
@@ -78,7 +81,9 @@ public class PropertyCreateCommand extends EditElementCommand {
*/
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
Property newElement = UMLFactory.eINSTANCE.createProperty();
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
if (data.isPermitted()) {
@@ -87,14 +92,21 @@ public class PropertyCreateCommand extends EditElementCommand {
return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
}
} else {
+
StructuredClassifier qualifiedTarget = (StructuredClassifier) target;
- qualifiedTarget.getOwnedAttributes().add(newElement);
+ qualifiedTarget.getOwnedAttributes()
+ .add(newElement);
+
}
} else {
return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
}
+
+
ElementInitializers.getInstance().init_Property_3079(newElement);
+
doConfigure(newElement, monitor, info);
+
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PropertyForInterfaceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PropertyForInterfaceCreateCommand.java
index 7803bf62b84..e7f81f97d2d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PropertyForInterfaceCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PropertyForInterfaceCreateCommand.java
@@ -68,9 +68,12 @@ public class PropertyForInterfaceCreateCommand extends EditElementCommand {
*/
@Override
public boolean canExecute() {
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getProperty());
return data.isPermitted();
+
+
}
/**
@@ -78,7 +81,9 @@ public class PropertyForInterfaceCreateCommand extends EditElementCommand {
*/
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
Property newElement = UMLFactory.eINSTANCE.createProperty();
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
if (data.isPermitted()) {
@@ -87,14 +92,21 @@ public class PropertyForInterfaceCreateCommand extends EditElementCommand {
return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
}
} else {
+
Interface qualifiedTarget = (Interface) target;
- qualifiedTarget.getOwnedAttributes().add(newElement);
+ qualifiedTarget.getOwnedAttributes()
+ .add(newElement);
+
}
} else {
return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
}
+
+
ElementInitializers.getInstance().init_Property_1(newElement);
+
doConfigure(newElement, monitor, info);
+
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ReceptionInInterfaceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ReceptionInInterfaceCreateCommand.java
index 32e461b3a90..282f0c1fa5a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ReceptionInInterfaceCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ReceptionInInterfaceCreateCommand.java
@@ -68,9 +68,12 @@ public class ReceptionInInterfaceCreateCommand extends EditElementCommand {
*/
@Override
public boolean canExecute() {
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getReception());
return data.isPermitted();
+
+
}
/**
@@ -78,7 +81,9 @@ public class ReceptionInInterfaceCreateCommand extends EditElementCommand {
*/
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
Reception newElement = UMLFactory.eINSTANCE.createReception();
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
if (data.isPermitted()) {
@@ -87,14 +92,21 @@ public class ReceptionInInterfaceCreateCommand extends EditElementCommand {
return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
}
} else {
+
Interface qualifiedTarget = (Interface) target;
- qualifiedTarget.getOwnedReceptions().add(newElement);
+ qualifiedTarget.getOwnedReceptions()
+ .add(newElement);
+
}
} else {
return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
}
+
+
ElementInitializers.getInstance().init_Reception_6(newElement);
+
doConfigure(newElement, monitor, info);
+
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/RectangleInterfaceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/RectangleInterfaceCreateCommand.java
index 044c1dcf700..7a032dab577 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/RectangleInterfaceCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/RectangleInterfaceCreateCommand.java
@@ -68,9 +68,12 @@ public class RectangleInterfaceCreateCommand extends EditElementCommand {
*/
@Override
public boolean canExecute() {
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInterface());
return data.isPermitted();
+
+
}
/**
@@ -78,7 +81,9 @@ public class RectangleInterfaceCreateCommand extends EditElementCommand {
*/
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
Interface newElement = UMLFactory.eINSTANCE.createInterface();
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
if (data.isPermitted()) {
@@ -87,14 +92,21 @@ public class RectangleInterfaceCreateCommand extends EditElementCommand {
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);
+ qualifiedTarget.getPackagedElements()
+ .add(newElement);
+
}
} else {
return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
}
+
+
ElementInitializers.getInstance().init_Interface_3205(newElement);
+
doConfigure(newElement, monitor, info);
+
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/SubstitutionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/SubstitutionCreateCommand.java
index 664f7c5a647..2e17ef1fed8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/SubstitutionCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/SubstitutionCreateCommand.java
@@ -91,14 +91,19 @@ public class SubstitutionCreateCommand extends EditElementCommand {
if (!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
+
Substitution newElement = UMLFactory.eINSTANCE.createSubstitution();
- getContainer().getPackagedElements().add(newElement);
- newElement.getClients().add(getSource());
- newElement.getSuppliers().add(getTarget());
+ getContainer().getPackagedElements()
+ .add(newElement);
+ newElement.getClients()
+ .add(getSource());
+ newElement.getSuppliers()
+ .add(getTarget());
ElementInitializers.getInstance().init_Substitution_4012(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/SubstitutionReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/SubstitutionReorientCommand.java
index c7f4c28af2b..4d465c90f7b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/SubstitutionReorientCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/SubstitutionReorientCommand.java
@@ -78,10 +78,12 @@ public class SubstitutionReorientCommand extends EditElementCommand {
if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
return false;
}
- if (getLink().getSuppliers().size() != 1) {
+ if (getLink().getSuppliers()
+ .size() != 1) {
return false;
}
- NamedElement target = getLink().getSuppliers().get(0);
+ NamedElement target = getLink().getSuppliers()
+ .get(0);
if (!(getLink().eContainer() instanceof Package)) {
return false;
}
@@ -96,10 +98,12 @@ public class SubstitutionReorientCommand extends EditElementCommand {
if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
return false;
}
- if (getLink().getClients().size() != 1) {
+ if (getLink().getClients()
+ .size() != 1) {
return false;
}
- NamedElement source = getLink().getClients().get(0);
+ NamedElement source = getLink().getClients()
+ .get(0);
if (!(getLink().eContainer() instanceof Package)) {
return false;
}
@@ -128,8 +132,10 @@ public class SubstitutionReorientCommand extends EditElementCommand {
* @generated
*/
protected CommandResult reorientSource() throws ExecutionException {
- getLink().getClients().remove(getOldSource());
- getLink().getClients().add(getNewSource());
+ getLink().getClients()
+ .remove(getOldSource());
+ getLink().getClients()
+ .add(getNewSource());
return CommandResult.newOKCommandResult(getLink());
}
@@ -137,8 +143,10 @@ public class SubstitutionReorientCommand extends EditElementCommand {
* @generated
*/
protected CommandResult reorientTarget() throws ExecutionException {
- getLink().getSuppliers().remove(getOldTarget());
- getLink().getSuppliers().add(getNewTarget());
+ getLink().getSuppliers()
+ .remove(getOldTarget());
+ getLink().getSuppliers()
+ .add(getNewTarget());
return CommandResult.newOKCommandResult(getLink());
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/UsageCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/UsageCreateCommand.java
index 4361c455adb..c3b25b9875d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/UsageCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/UsageCreateCommand.java
@@ -91,14 +91,19 @@ public class UsageCreateCommand extends EditElementCommand {
if (!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
+
Usage newElement = UMLFactory.eINSTANCE.createUsage();
- getContainer().getPackagedElements().add(newElement);
- newElement.getClients().add(getSource());
- newElement.getSuppliers().add(getTarget());
+ getContainer().getPackagedElements()
+ .add(newElement);
+ newElement.getClients()
+ .add(getSource());
+ newElement.getSuppliers()
+ .add(getTarget());
ElementInitializers.getInstance().init_Usage_4001(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/UsageReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/UsageReorientCommand.java
index a4ddcaa793c..9cdb5535431 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/UsageReorientCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/UsageReorientCommand.java
@@ -78,10 +78,12 @@ public class UsageReorientCommand extends EditElementCommand {
if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
return false;
}
- if (getLink().getSuppliers().size() != 1) {
+ if (getLink().getSuppliers()
+ .size() != 1) {
return false;
}
- NamedElement target = getLink().getSuppliers().get(0);
+ NamedElement target = getLink().getSuppliers()
+ .get(0);
if (!(getLink().eContainer() instanceof Package)) {
return false;
}
@@ -96,10 +98,12 @@ public class UsageReorientCommand extends EditElementCommand {
if (!(oldEnd instanceof NamedElement && newEnd instanceof NamedElement)) {
return false;
}
- if (getLink().getClients().size() != 1) {
+ if (getLink().getClients()
+ .size() != 1) {
return false;
}
- NamedElement source = getLink().getClients().get(0);
+ NamedElement source = getLink().getClients()
+ .get(0);
if (!(getLink().eContainer() instanceof Package)) {
return false;
}
@@ -128,8 +132,10 @@ public class UsageReorientCommand extends EditElementCommand {
* @generated
*/
protected CommandResult reorientSource() throws ExecutionException {
- getLink().getClients().remove(getOldSource());
- getLink().getClients().add(getNewSource());
+ getLink().getClients()
+ .remove(getOldSource());
+ getLink().getClients()
+ .add(getNewSource());
return CommandResult.newOKCommandResult(getLink());
}
@@ -137,8 +143,10 @@ public class UsageReorientCommand extends EditElementCommand {
* @generated
*/
protected CommandResult reorientTarget() throws ExecutionException {
- getLink().getSuppliers().remove(getOldTarget());
- getLink().getSuppliers().add(getNewTarget());
+ getLink().getSuppliers()
+ .remove(getOldTarget());
+ getLink().getSuppliers()
+ .add(getNewTarget());
return CommandResult.newOKCommandResult(getLink());
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/AbstractionAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/AbstractionAppliedStereotypeEditPart.java
index 7a80a3e9e32..2402a7b327d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/AbstractionAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/AbstractionAppliedStereotypeEditPart.java
@@ -1,789 +1,828 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.component.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.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.component.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.component.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 AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 6021;
-
- /**
- * @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.component.edit.parts.AbstractionAppliedStereotypeEditPart.VISUAL_ID), new Point(0, 30));
- }
-
- /**
- * @generated
- */
- public AbstractionAppliedStereotypeEditPart(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());
- }
-
- /**
- * @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
- */
- 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.Abstraction_4013, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.edit.parts.AbstractionAppliedStereotypeEditPart.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() {
- // 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.component.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.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.component.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.component.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 AbstractionAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6021;
+
+ /**
+ * @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.component.edit.parts.AbstractionAppliedStereotypeEditPart.VISUAL_ID), new Point(0, 30));
+ }
+
+ /**
+ * @generated
+ */
+ public AbstractionAppliedStereotypeEditPart(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.Abstraction_4013, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.edit.parts.AbstractionAppliedStereotypeEditPart.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() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/AbstractionEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/AbstractionEditPart.java
index cbcacef19c1..50ec9e95141 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/AbstractionEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/AbstractionEditPart.java
@@ -59,10 +59,12 @@ public class AbstractionEditPart extends UMLConnectionNodeEditPart implements IT
*/
protected boolean addFixedChild(EditPart childEditPart) {
if (childEditPart instanceof AbstractionNameEditPart) {
- ((AbstractionNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ ((AbstractionNameEditPart) childEditPart).setLabel(
+ getPrimaryShape().getNameLabel());
}
if (childEditPart instanceof AbstractionAppliedStereotypeEditPart) {
- ((AbstractionAppliedStereotypeEditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
+ ((AbstractionAppliedStereotypeEditPart) childEditPart).setLabel(
+ getPrimaryShape().getAppliedStereotypeLabel());
}
return false;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/AbstractionNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/AbstractionNameEditPart.java
index 6250daab339..6d3f27654cd 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/AbstractionNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/AbstractionNameEditPart.java
@@ -1,789 +1,828 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.component.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.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.component.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.component.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 AbstractionNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 6007;
-
- /**
- * @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.component.edit.parts.AbstractionNameEditPart.VISUAL_ID), new Point(0, 60));
- }
-
- /**
- * @generated
- */
- public AbstractionNameEditPart(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());
- }
-
- /**
- * @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
- */
- 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.Abstraction_4013, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.edit.parts.AbstractionNameEditPart.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() {
- // 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.component.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.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.component.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.component.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 AbstractionNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6007;
+
+ /**
+ * @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.component.edit.parts.AbstractionNameEditPart.VISUAL_ID), new Point(0, 60));
+ }
+
+ /**
+ * @generated
+ */
+ public AbstractionNameEditPart(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.Abstraction_4013, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.edit.parts.AbstractionNameEditPart.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() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/CommentBodyEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/CommentBodyEditPart.java
index 3c4efe0de31..f1bd5a509d3 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/CommentBodyEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/CommentBodyEditPart.java
@@ -195,7 +195,8 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -248,7 +249,9 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
@@ -280,7 +283,9 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -303,18 +308,21 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I
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));
- }
- });
+ 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;
}
@@ -356,7 +364,9 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I
*/
protected DirectEditManager getManager() {
if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -406,7 +416,9 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I
*/
@Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
+
if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
@@ -418,7 +430,9 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I
updateExtendedEditorConfiguration();
if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
performDefaultDirectEditorEdit(theRequest);
} else {
configuration.preEditAction(resolveSemanticElement());
@@ -431,14 +445,17 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I
IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ }
+ 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);
+ 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") {
@@ -446,6 +463,7 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I
@Override
protected void doExecute() {
configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -467,14 +485,15 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I
// 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) {
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -511,7 +530,8 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I
if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
@@ -530,14 +550,17 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I
* @generated
*/
protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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 {
+ }
+ else {
((WrappingLabel) getFigure()).setTextUnderline(false);
}
}
@@ -547,7 +570,9 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ FontStyle style =
+ (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
@@ -558,9 +583,14 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I
*/
@Override
protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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));
+ FontData fontData = new FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
+ (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
@@ -641,6 +671,7 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I
if (checkDefaultEdition()) {
return IDirectEdition.DEFAULT_DIRECT_EDITOR;
}
+
// not a named element. no specific editor => do nothing
return IDirectEdition.NO_DIRECT_EDITION;
}
@@ -690,9 +721,11 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I
* @generated
*/
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ 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());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
+ .eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
@@ -714,7 +747,8 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I
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);
+ 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;
@@ -762,15 +796,18 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I
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)) {
+ } 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();
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
@@ -810,7 +847,8 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I
* @generated
*/
protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
}
/**
@@ -820,6 +858,7 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I
public void deactivate() {
removeOwnerElementListeners();
super.deactivate();
+
}
/**
@@ -827,5 +866,6 @@ public class CommentBodyEditPart extends PapyrusCompartmentEditPart implements I
*/
protected void removeOwnerElementListeners() {
removeListenerFilter(ADD_PARENT_MODEL);
+
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/CommentBodyEditPartPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/CommentBodyEditPartPCN.java
index 3cf2a9be938..78d8e021298 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/CommentBodyEditPartPCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/CommentBodyEditPartPCN.java
@@ -195,7 +195,8 @@ public class CommentBodyEditPartPCN extends PapyrusCompartmentEditPart implement
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -248,7 +249,9 @@ public class CommentBodyEditPartPCN extends PapyrusCompartmentEditPart implement
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
@@ -280,7 +283,9 @@ public class CommentBodyEditPartPCN extends PapyrusCompartmentEditPart implement
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -303,18 +308,21 @@ public class CommentBodyEditPartPCN extends PapyrusCompartmentEditPart implement
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));
- }
- });
+ 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;
}
@@ -356,7 +364,9 @@ public class CommentBodyEditPartPCN extends PapyrusCompartmentEditPart implement
*/
protected DirectEditManager getManager() {
if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -406,7 +416,9 @@ public class CommentBodyEditPartPCN extends PapyrusCompartmentEditPart implement
*/
@Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
+
if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
@@ -418,7 +430,9 @@ public class CommentBodyEditPartPCN extends PapyrusCompartmentEditPart implement
updateExtendedEditorConfiguration();
if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
performDefaultDirectEditorEdit(theRequest);
} else {
configuration.preEditAction(resolveSemanticElement());
@@ -431,14 +445,17 @@ public class CommentBodyEditPartPCN extends PapyrusCompartmentEditPart implement
IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ }
+ 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);
+ 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") {
@@ -446,6 +463,7 @@ public class CommentBodyEditPartPCN extends PapyrusCompartmentEditPart implement
@Override
protected void doExecute() {
configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -467,14 +485,15 @@ public class CommentBodyEditPartPCN extends PapyrusCompartmentEditPart implement
// 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) {
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -511,7 +530,8 @@ public class CommentBodyEditPartPCN extends PapyrusCompartmentEditPart implement
if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
@@ -530,14 +550,17 @@ public class CommentBodyEditPartPCN extends PapyrusCompartmentEditPart implement
* @generated
*/
protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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 {
+ }
+ else {
((WrappingLabel) getFigure()).setTextUnderline(false);
}
}
@@ -547,7 +570,9 @@ public class CommentBodyEditPartPCN extends PapyrusCompartmentEditPart implement
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ FontStyle style =
+ (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
@@ -558,9 +583,14 @@ public class CommentBodyEditPartPCN extends PapyrusCompartmentEditPart implement
*/
@Override
protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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));
+ FontData fontData = new FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
+ (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
@@ -641,6 +671,7 @@ public class CommentBodyEditPartPCN extends PapyrusCompartmentEditPart implement
if (checkDefaultEdition()) {
return IDirectEdition.DEFAULT_DIRECT_EDITOR;
}
+
// not a named element. no specific editor => do nothing
return IDirectEdition.NO_DIRECT_EDITION;
}
@@ -690,9 +721,11 @@ public class CommentBodyEditPartPCN extends PapyrusCompartmentEditPart implement
* @generated
*/
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ 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());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
+ .eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
@@ -714,7 +747,8 @@ public class CommentBodyEditPartPCN extends PapyrusCompartmentEditPart implement
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);
+ 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;
@@ -762,15 +796,18 @@ public class CommentBodyEditPartPCN extends PapyrusCompartmentEditPart implement
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)) {
+ } 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();
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
@@ -810,7 +847,8 @@ public class CommentBodyEditPartPCN extends PapyrusCompartmentEditPart implement
* @generated
*/
protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
}
/**
@@ -820,6 +858,7 @@ public class CommentBodyEditPartPCN extends PapyrusCompartmentEditPart implement
public void deactivate() {
removeOwnerElementListeners();
super.deactivate();
+
}
/**
@@ -827,5 +866,6 @@ public class CommentBodyEditPartPCN extends PapyrusCompartmentEditPart implement
*/
protected void removeOwnerElementListeners() {
removeListenerFilter(ADD_PARENT_MODEL);
+
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/CommentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/CommentEditPart.java
index 64f3b5a0916..8d754cc92d6 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/CommentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/CommentEditPart.java
@@ -116,6 +116,7 @@ public class CommentEditPart extends AbstractCommentEditPart {
@Override
protected void handleNotificationEvent(Notification event) {
super.handleNotificationEvent(event);
+
}
/**
@@ -144,6 +145,8 @@ public class CommentEditPart extends AbstractCommentEditPart {
((CommentBodyEditPart) childEditPart).setLabel(getPrimaryShape().getCornerBentFigure());
return true;
}
+
+
return false;
}
@@ -207,6 +210,7 @@ public class CommentEditPart extends AbstractCommentEditPart {
@Override
protected NodeFigure createNodeFigure() {
return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/CommentEditPartPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/CommentEditPartPCN.java
index 57e9238f754..4d485d35bb1 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/CommentEditPartPCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/CommentEditPartPCN.java
@@ -116,6 +116,7 @@ public class CommentEditPartPCN extends AbstractCommentEditPart {
@Override
protected void handleNotificationEvent(Notification event) {
super.handleNotificationEvent(event);
+
}
/**
@@ -144,6 +145,8 @@ public class CommentEditPartPCN extends AbstractCommentEditPart {
((CommentBodyEditPartPCN) childEditPart).setLabel(getPrimaryShape().getCornerBentFigure());
return true;
}
+
+
return false;
}
@@ -207,6 +210,7 @@ public class CommentEditPartPCN extends AbstractCommentEditPart {
@Override
protected NodeFigure createNodeFigure() {
return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentCompositeCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentCompositeCompartmentEditPart.java
index 708bf7311fd..5ee72975d91 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentCompositeCompartmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentCompositeCompartmentEditPart.java
@@ -69,8 +69,9 @@ public class ComponentCompositeCompartmentEditPart extends ShapeCompartmentEditP
installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.edit.policies.ComponentCompositeCompartmentCanonicalEditPolicy());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.edit.policies.ComponentCompositeCompartmentCanonicalEditPolicy());
+
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
}
@@ -90,6 +91,7 @@ public class ComponentCompositeCompartmentEditPart extends ShapeCompartmentEditP
*/
@Override
public EditPart getTargetEditPart(Request request) {
+
return super.getTargetEditPart(request);
}
@@ -99,7 +101,10 @@ public class ComponentCompositeCompartmentEditPart extends ShapeCompartmentEditP
@Override
protected void handleNotificationEvent(Notification notification) {
Object feature = notification.getFeature();
- if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ if (NotationPackage.eINSTANCE.getSize_Width().equals(feature)
+ || NotationPackage.eINSTANCE.getSize_Height().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_X().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
refreshBounds();
}
super.handleNotificationEvent(notification);
@@ -115,7 +120,10 @@ public class ComponentCompositeCompartmentEditPart extends ShapeCompartmentEditP
int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
Point loc = new Point(x, y);
- ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(
+ this,
+ getFigure(),
+ new Rectangle(loc, size));
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentCompositeCompartmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentCompositeCompartmentEditPartCN.java
index 8e7d447668f..bec07aec8e2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentCompositeCompartmentEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentCompositeCompartmentEditPartCN.java
@@ -69,8 +69,9 @@ public class ComponentCompositeCompartmentEditPartCN extends ShapeCompartmentEdi
installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.edit.policies.ComponentCompositeCompartmentCanonicalEditPolicyCN());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.edit.policies.ComponentCompositeCompartmentCanonicalEditPolicyCN());
+
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
}
@@ -90,6 +91,7 @@ public class ComponentCompositeCompartmentEditPartCN extends ShapeCompartmentEdi
*/
@Override
public EditPart getTargetEditPart(Request request) {
+
return super.getTargetEditPart(request);
}
@@ -99,7 +101,10 @@ public class ComponentCompositeCompartmentEditPartCN extends ShapeCompartmentEdi
@Override
protected void handleNotificationEvent(Notification notification) {
Object feature = notification.getFeature();
- if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ if (NotationPackage.eINSTANCE.getSize_Width().equals(feature)
+ || NotationPackage.eINSTANCE.getSize_Height().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_X().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
refreshBounds();
}
super.handleNotificationEvent(notification);
@@ -115,7 +120,10 @@ public class ComponentCompositeCompartmentEditPartCN extends ShapeCompartmentEdi
int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
Point loc = new Point(x, y);
- ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(
+ this,
+ getFigure(),
+ new Rectangle(loc, size));
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentCompositeCompartmentEditPartPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentCompositeCompartmentEditPartPCN.java
index 891d1f74288..f42f0a0d4c9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentCompositeCompartmentEditPartPCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentCompositeCompartmentEditPartPCN.java
@@ -69,8 +69,9 @@ public class ComponentCompositeCompartmentEditPartPCN extends ShapeCompartmentEd
installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.edit.policies.ComponentCompositeCompartmentCanonicalEditPolicyPCN());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.edit.policies.ComponentCompositeCompartmentCanonicalEditPolicyPCN());
+
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
}
@@ -90,6 +91,7 @@ public class ComponentCompositeCompartmentEditPartPCN extends ShapeCompartmentEd
*/
@Override
public EditPart getTargetEditPart(Request request) {
+
return super.getTargetEditPart(request);
}
@@ -99,7 +101,10 @@ public class ComponentCompositeCompartmentEditPartPCN extends ShapeCompartmentEd
@Override
protected void handleNotificationEvent(Notification notification) {
Object feature = notification.getFeature();
- if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ if (NotationPackage.eINSTANCE.getSize_Width().equals(feature)
+ || NotationPackage.eINSTANCE.getSize_Height().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_X().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
refreshBounds();
}
super.handleNotificationEvent(notification);
@@ -115,7 +120,10 @@ public class ComponentCompositeCompartmentEditPartPCN extends ShapeCompartmentEd
int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
Point loc = new Point(x, y);
- ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(
+ this,
+ getFigure(),
+ new Rectangle(loc, size));
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentDiagramEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentDiagramEditPart.java
index e13489d363c..2e23250cf7c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentDiagramEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentDiagramEditPart.java
@@ -48,11 +48,14 @@ public class ComponentDiagramEditPart extends PapyrusDiagramEditPart {
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
+
installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
+
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ComponentDiagramItemSemanticEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.edit.policies.ModelCanonicalEditPolicy());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.edit.policies.ModelCanonicalEditPolicy());
+
installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
// removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentEditPart.java
index 22a44d973ae..38ed7c4dfaa 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentEditPart.java
@@ -86,8 +86,9 @@ public class ComponentEditPart extends NamedElementEditPart {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ComponentItemSemanticEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.edit.policies.ComponentCanonicalEditPolicy());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.edit.policies.ComponentCanonicalEditPolicy());
+
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
@@ -142,6 +143,7 @@ public class ComponentEditPart extends NamedElementEditPart {
@Override
protected void handleNotificationEvent(Notification event) {
super.handleNotificationEvent(event);
+
}
/**
@@ -170,18 +172,25 @@ public class ComponentEditPart extends NamedElementEditPart {
((ComponentNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
return true;
}
+
+
if (childEditPart instanceof ComponentCompositeCompartmentEditPart) {
IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
pane.add(((ComponentCompositeCompartmentEditPart) childEditPart).getFigure());
return true;
}
- // Papyrus Gencode :Affixed Port locator
+
+
+
+ //Papyrus Gencode :Affixed Port locator
if (childEditPart instanceof PortEditPart) {
IBorderItemLocator locator = new PortPositionLocator(getMainFigure(), PositionConstants.NONE);
getBorderedFigure().getBorderItemContainer().add(((PortEditPart) childEditPart).getFigure(), locator);
return true;
}
+
+
return false;
}
@@ -260,6 +269,7 @@ public class ComponentEditPart extends NamedElementEditPart {
@Override
protected NodeFigure createMainFigure() {
return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentEditPartCN.java
index 68e78dc1937..0090b3bf462 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentEditPartCN.java
@@ -86,8 +86,9 @@ public class ComponentEditPartCN extends NamedElementEditPart {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ComponentItemSemanticEditPolicyCN());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.edit.policies.ComponentCanonicalEditPolicyCN());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.edit.policies.ComponentCanonicalEditPolicyCN());
+
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
@@ -142,6 +143,7 @@ public class ComponentEditPartCN extends NamedElementEditPart {
@Override
protected void handleNotificationEvent(Notification event) {
super.handleNotificationEvent(event);
+
}
/**
@@ -170,18 +172,25 @@ public class ComponentEditPartCN extends NamedElementEditPart {
((ComponentNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
return true;
}
+
+
if (childEditPart instanceof ComponentCompositeCompartmentEditPartCN) {
IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
pane.add(((ComponentCompositeCompartmentEditPartCN) childEditPart).getFigure());
return true;
}
- // Papyrus Gencode :Affixed Port locator
+
+
+
+ //Papyrus Gencode :Affixed Port locator
if (childEditPart instanceof PortEditPart) {
IBorderItemLocator locator = new PortPositionLocator(getMainFigure(), PositionConstants.NONE);
getBorderedFigure().getBorderItemContainer().add(((PortEditPart) childEditPart).getFigure(), locator);
return true;
}
+
+
return false;
}
@@ -260,6 +269,7 @@ public class ComponentEditPartCN extends NamedElementEditPart {
@Override
protected NodeFigure createMainFigure() {
return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentEditPartPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentEditPartPCN.java
index d9890af36d5..4d5aa5d7c77 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentEditPartPCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentEditPartPCN.java
@@ -86,8 +86,9 @@ public class ComponentEditPartPCN extends NamedElementEditPart {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ComponentItemSemanticEditPolicyPCN());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.edit.policies.ComponentCanonicalEditPolicyPCN());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.edit.policies.ComponentCanonicalEditPolicyPCN());
+
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
@@ -142,6 +143,7 @@ public class ComponentEditPartPCN extends NamedElementEditPart {
@Override
protected void handleNotificationEvent(Notification event) {
super.handleNotificationEvent(event);
+
}
/**
@@ -170,18 +172,25 @@ public class ComponentEditPartPCN extends NamedElementEditPart {
((ComponentNameEditPartPCN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
return true;
}
+
+
if (childEditPart instanceof ComponentCompositeCompartmentEditPartPCN) {
IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
pane.add(((ComponentCompositeCompartmentEditPartPCN) childEditPart).getFigure());
return true;
}
- // Papyrus Gencode :Affixed Port locator
+
+
+
+ //Papyrus Gencode :Affixed Port locator
if (childEditPart instanceof PortEditPart) {
IBorderItemLocator locator = new PortPositionLocator(getMainFigure(), PositionConstants.NONE);
getBorderedFigure().getBorderItemContainer().add(((PortEditPart) childEditPart).getFigure(), locator);
return true;
}
+
+
return false;
}
@@ -260,6 +269,7 @@ public class ComponentEditPartPCN extends NamedElementEditPart {
@Override
protected NodeFigure createMainFigure() {
return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentNameEditPart.java
index 77e99c0084b..e7b02f4025f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentNameEditPart.java
@@ -199,7 +199,8 @@ public class ComponentNameEditPart extends PapyrusCompartmentEditPart implements
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -262,7 +263,9 @@ public class ComponentNameEditPart extends PapyrusCompartmentEditPart implements
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
@@ -294,7 +297,9 @@ public class ComponentNameEditPart extends PapyrusCompartmentEditPart implements
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -317,18 +322,21 @@ public class ComponentNameEditPart extends PapyrusCompartmentEditPart implements
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));
- }
- });
+ 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;
}
@@ -370,7 +378,9 @@ public class ComponentNameEditPart extends PapyrusCompartmentEditPart implements
*/
protected DirectEditManager getManager() {
if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -420,7 +430,9 @@ public class ComponentNameEditPart extends PapyrusCompartmentEditPart implements
*/
@Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
+
if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
@@ -432,7 +444,9 @@ public class ComponentNameEditPart extends PapyrusCompartmentEditPart implements
updateExtendedEditorConfiguration();
if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
performDefaultDirectEditorEdit(theRequest);
} else {
configuration.preEditAction(resolveSemanticElement());
@@ -445,14 +459,17 @@ public class ComponentNameEditPart extends PapyrusCompartmentEditPart implements
IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ }
+ 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);
+ 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") {
@@ -460,6 +477,7 @@ public class ComponentNameEditPart extends PapyrusCompartmentEditPart implements
@Override
protected void doExecute() {
configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -481,14 +499,15 @@ public class ComponentNameEditPart extends PapyrusCompartmentEditPart implements
// 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) {
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -525,7 +544,8 @@ public class ComponentNameEditPart extends PapyrusCompartmentEditPart implements
if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
@@ -544,14 +564,17 @@ public class ComponentNameEditPart extends PapyrusCompartmentEditPart implements
* @generated
*/
protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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 {
+ }
+ else {
((WrappingLabel) getFigure()).setTextUnderline(false);
}
}
@@ -561,7 +584,9 @@ public class ComponentNameEditPart extends PapyrusCompartmentEditPart implements
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ FontStyle style =
+ (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
@@ -572,9 +597,14 @@ public class ComponentNameEditPart extends PapyrusCompartmentEditPart implements
*/
@Override
protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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));
+ FontData fontData = new FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
+ (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
@@ -655,6 +685,7 @@ public class ComponentNameEditPart extends PapyrusCompartmentEditPart implements
if (checkDefaultEdition()) {
return IDirectEdition.DEFAULT_DIRECT_EDITOR;
}
+
// not a named element. no specific editor => do nothing
return IDirectEdition.NO_DIRECT_EDITION;
}
@@ -704,9 +735,11 @@ public class ComponentNameEditPart extends PapyrusCompartmentEditPart implements
* @generated
*/
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ 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());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
+ .eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
@@ -728,7 +761,8 @@ public class ComponentNameEditPart extends PapyrusCompartmentEditPart implements
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);
+ 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;
@@ -776,15 +810,18 @@ public class ComponentNameEditPart extends PapyrusCompartmentEditPart implements
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)) {
+ } 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();
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
@@ -827,7 +864,8 @@ public class ComponentNameEditPart extends PapyrusCompartmentEditPart implements
* @generated
*/
protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
}
/**
@@ -837,6 +875,7 @@ public class ComponentNameEditPart extends PapyrusCompartmentEditPart implements
public void deactivate() {
removeOwnerElementListeners();
super.deactivate();
+
}
/**
@@ -844,5 +883,6 @@ public class ComponentNameEditPart extends PapyrusCompartmentEditPart implements
*/
protected void removeOwnerElementListeners() {
removeListenerFilter(ADD_PARENT_MODEL);
+
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentNameEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentNameEditPartCN.java
index b82c110a48e..7982ce9c084 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentNameEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentNameEditPartCN.java
@@ -199,7 +199,8 @@ public class ComponentNameEditPartCN extends PapyrusCompartmentEditPart implemen
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -262,7 +263,9 @@ public class ComponentNameEditPartCN extends PapyrusCompartmentEditPart implemen
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
@@ -294,7 +297,9 @@ public class ComponentNameEditPartCN extends PapyrusCompartmentEditPart implemen
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -317,18 +322,21 @@ public class ComponentNameEditPartCN extends PapyrusCompartmentEditPart implemen
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));
- }
- });
+ 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;
}
@@ -370,7 +378,9 @@ public class ComponentNameEditPartCN extends PapyrusCompartmentEditPart implemen
*/
protected DirectEditManager getManager() {
if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -420,7 +430,9 @@ public class ComponentNameEditPartCN extends PapyrusCompartmentEditPart implemen
*/
@Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
+
if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
@@ -432,7 +444,9 @@ public class ComponentNameEditPartCN extends PapyrusCompartmentEditPart implemen
updateExtendedEditorConfiguration();
if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
performDefaultDirectEditorEdit(theRequest);
} else {
configuration.preEditAction(resolveSemanticElement());
@@ -445,14 +459,17 @@ public class ComponentNameEditPartCN extends PapyrusCompartmentEditPart implemen
IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ }
+ 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);
+ 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") {
@@ -460,6 +477,7 @@ public class ComponentNameEditPartCN extends PapyrusCompartmentEditPart implemen
@Override
protected void doExecute() {
configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -481,14 +499,15 @@ public class ComponentNameEditPartCN extends PapyrusCompartmentEditPart implemen
// 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) {
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -525,7 +544,8 @@ public class ComponentNameEditPartCN extends PapyrusCompartmentEditPart implemen
if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
@@ -544,14 +564,17 @@ public class ComponentNameEditPartCN extends PapyrusCompartmentEditPart implemen
* @generated
*/
protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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 {
+ }
+ else {
((WrappingLabel) getFigure()).setTextUnderline(false);
}
}
@@ -561,7 +584,9 @@ public class ComponentNameEditPartCN extends PapyrusCompartmentEditPart implemen
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ FontStyle style =
+ (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
@@ -572,9 +597,14 @@ public class ComponentNameEditPartCN extends PapyrusCompartmentEditPart implemen
*/
@Override
protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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));
+ FontData fontData = new FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
+ (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
@@ -655,6 +685,7 @@ public class ComponentNameEditPartCN extends PapyrusCompartmentEditPart implemen
if (checkDefaultEdition()) {
return IDirectEdition.DEFAULT_DIRECT_EDITOR;
}
+
// not a named element. no specific editor => do nothing
return IDirectEdition.NO_DIRECT_EDITION;
}
@@ -704,9 +735,11 @@ public class ComponentNameEditPartCN extends PapyrusCompartmentEditPart implemen
* @generated
*/
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ 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());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
+ .eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
@@ -728,7 +761,8 @@ public class ComponentNameEditPartCN extends PapyrusCompartmentEditPart implemen
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);
+ 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;
@@ -776,15 +810,18 @@ public class ComponentNameEditPartCN extends PapyrusCompartmentEditPart implemen
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)) {
+ } 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();
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
@@ -827,7 +864,8 @@ public class ComponentNameEditPartCN extends PapyrusCompartmentEditPart implemen
* @generated
*/
protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
}
/**
@@ -837,6 +875,7 @@ public class ComponentNameEditPartCN extends PapyrusCompartmentEditPart implemen
public void deactivate() {
removeOwnerElementListeners();
super.deactivate();
+
}
/**
@@ -844,5 +883,6 @@ public class ComponentNameEditPartCN extends PapyrusCompartmentEditPart implemen
*/
protected void removeOwnerElementListeners() {
removeListenerFilter(ADD_PARENT_MODEL);
+
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentNameEditPartPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentNameEditPartPCN.java
index b3290c4be9e..8a1ce29459c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentNameEditPartPCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentNameEditPartPCN.java
@@ -195,7 +195,8 @@ public class ComponentNameEditPartPCN extends PapyrusCompartmentEditPart impleme
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -248,7 +249,9 @@ public class ComponentNameEditPartPCN extends PapyrusCompartmentEditPart impleme
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
@@ -280,7 +283,9 @@ public class ComponentNameEditPartPCN extends PapyrusCompartmentEditPart impleme
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -303,18 +308,21 @@ public class ComponentNameEditPartPCN extends PapyrusCompartmentEditPart impleme
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));
- }
- });
+ 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;
}
@@ -356,7 +364,9 @@ public class ComponentNameEditPartPCN extends PapyrusCompartmentEditPart impleme
*/
protected DirectEditManager getManager() {
if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -406,7 +416,9 @@ public class ComponentNameEditPartPCN extends PapyrusCompartmentEditPart impleme
*/
@Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
+
if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
@@ -418,7 +430,9 @@ public class ComponentNameEditPartPCN extends PapyrusCompartmentEditPart impleme
updateExtendedEditorConfiguration();
if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
performDefaultDirectEditorEdit(theRequest);
} else {
configuration.preEditAction(resolveSemanticElement());
@@ -431,14 +445,17 @@ public class ComponentNameEditPartPCN extends PapyrusCompartmentEditPart impleme
IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ }
+ 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);
+ 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") {
@@ -446,6 +463,7 @@ public class ComponentNameEditPartPCN extends PapyrusCompartmentEditPart impleme
@Override
protected void doExecute() {
configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -467,14 +485,15 @@ public class ComponentNameEditPartPCN extends PapyrusCompartmentEditPart impleme
// 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) {
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -511,7 +530,8 @@ public class ComponentNameEditPartPCN extends PapyrusCompartmentEditPart impleme
if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
@@ -530,14 +550,17 @@ public class ComponentNameEditPartPCN extends PapyrusCompartmentEditPart impleme
* @generated
*/
protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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 {
+ }
+ else {
((WrappingLabel) getFigure()).setTextUnderline(false);
}
}
@@ -547,7 +570,9 @@ public class ComponentNameEditPartPCN extends PapyrusCompartmentEditPart impleme
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ FontStyle style =
+ (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
@@ -558,9 +583,14 @@ public class ComponentNameEditPartPCN extends PapyrusCompartmentEditPart impleme
*/
@Override
protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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));
+ FontData fontData = new FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
+ (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
@@ -641,6 +671,7 @@ public class ComponentNameEditPartPCN extends PapyrusCompartmentEditPart impleme
if (checkDefaultEdition()) {
return IDirectEdition.DEFAULT_DIRECT_EDITOR;
}
+
// not a named element. no specific editor => do nothing
return IDirectEdition.NO_DIRECT_EDITION;
}
@@ -690,9 +721,11 @@ public class ComponentNameEditPartPCN extends PapyrusCompartmentEditPart impleme
* @generated
*/
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ 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());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
+ .eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
@@ -714,7 +747,8 @@ public class ComponentNameEditPartPCN extends PapyrusCompartmentEditPart impleme
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);
+ 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;
@@ -762,15 +796,18 @@ public class ComponentNameEditPartPCN extends PapyrusCompartmentEditPart impleme
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)) {
+ } 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();
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
@@ -810,7 +847,8 @@ public class ComponentNameEditPartPCN extends PapyrusCompartmentEditPart impleme
* @generated
*/
protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
}
/**
@@ -820,6 +858,7 @@ public class ComponentNameEditPartPCN extends PapyrusCompartmentEditPart impleme
public void deactivate() {
removeOwnerElementListeners();
super.deactivate();
+
}
/**
@@ -827,5 +866,6 @@ public class ComponentNameEditPartPCN extends PapyrusCompartmentEditPart impleme
*/
protected void removeOwnerElementListeners() {
removeListenerFilter(ADD_PARENT_MODEL);
+
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentRealizationAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentRealizationAppliedStereotypeEditPart.java
index 4791b33e804..0875fb7a26b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentRealizationAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentRealizationAppliedStereotypeEditPart.java
@@ -1,782 +1,820 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.component.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.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.component.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.component.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 ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart 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.component.edit.parts.ComponentRealizationAppliedStereotypeEditPart.VISUAL_ID), new Point(0, 30));
- }
-
- /**
- * @generated
- */
- public ComponentRealizationAppliedStereotypeEditPart(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());
- }
-
- /**
- * @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
- */
- 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.ComponentRealization_4007, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.edit.parts.ComponentRealizationAppliedStereotypeEditPart.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() {
- // 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.component.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.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.component.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.component.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 ComponentRealizationAppliedStereotypeEditPart extends PapyrusLabelEditPart 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.component.edit.parts.ComponentRealizationAppliedStereotypeEditPart.VISUAL_ID), new Point(0, 30));
+ }
+
+ /**
+ * @generated
+ */
+ public ComponentRealizationAppliedStereotypeEditPart(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.ComponentRealization_4007, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.edit.parts.ComponentRealizationAppliedStereotypeEditPart.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() {
+ // 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;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentRealizationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentRealizationEditPart.java
index d86403cd2d5..bc62c5c563c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentRealizationEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentRealizationEditPart.java
@@ -59,10 +59,12 @@ public class ComponentRealizationEditPart extends UMLConnectionNodeEditPart impl
*/
protected boolean addFixedChild(EditPart childEditPart) {
if (childEditPart instanceof ComponentRealizationNameEditPart) {
- ((ComponentRealizationNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ ((ComponentRealizationNameEditPart) childEditPart).setLabel(
+ getPrimaryShape().getNameLabel());
}
if (childEditPart instanceof ComponentRealizationAppliedStereotypeEditPart) {
- ((ComponentRealizationAppliedStereotypeEditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
+ ((ComponentRealizationAppliedStereotypeEditPart) childEditPart).setLabel(
+ getPrimaryShape().getAppliedStereotypeLabel());
}
return false;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentRealizationNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentRealizationNameEditPart.java
index d4652dc9ea6..6197911da8c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentRealizationNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ComponentRealizationNameEditPart.java
@@ -1,789 +1,828 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.component.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.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.component.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.component.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 ComponentRealizationNameEditPart extends PapyrusLabelEditPart 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
- */
- static {
- registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.edit.parts.ComponentRealizationNameEditPart.VISUAL_ID), new Point(0, 60));
- }
-
- /**
- * @generated
- */
- public ComponentRealizationNameEditPart(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());
- }
-
- /**
- * @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
- */
- 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.ComponentRealization_4007, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.edit.parts.ComponentRealizationNameEditPart.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() {
- // 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.component.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.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.component.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.component.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 ComponentRealizationNameEditPart extends PapyrusLabelEditPart 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
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.edit.parts.ComponentRealizationNameEditPart.VISUAL_ID), new Point(0, 60));
+ }
+
+ /**
+ * @generated
+ */
+ public ComponentRealizationNameEditPart(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.ComponentRealization_4007, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.edit.parts.ComponentRealizationNameEditPart.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() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConnectorAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConnectorAppliedStereotypeEditPart.java
index f6449f4dac1..404fb7a9e2e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConnectorAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConnectorAppliedStereotypeEditPart.java
@@ -1,789 +1,828 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.component.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.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.component.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.component.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 ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 6024;
-
- /**
- * @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.component.edit.parts.ConnectorAppliedStereotypeEditPart.VISUAL_ID), new Point(0, 60));
- }
-
- /**
- * @generated
- */
- public ConnectorAppliedStereotypeEditPart(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());
- }
-
- /**
- * @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
- */
- 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.Connector_4019, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.edit.parts.ConnectorAppliedStereotypeEditPart.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() {
- // 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.component.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.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.component.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.component.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 ConnectorAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6024;
+
+ /**
+ * @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.component.edit.parts.ConnectorAppliedStereotypeEditPart.VISUAL_ID), new Point(0, 60));
+ }
+
+ /**
+ * @generated
+ */
+ public ConnectorAppliedStereotypeEditPart(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.Connector_4019, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.edit.parts.ConnectorAppliedStereotypeEditPart.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() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConnectorEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConnectorEditPart.java
index 84370958f5e..d9cb8efeae0 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConnectorEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConnectorEditPart.java
@@ -54,10 +54,12 @@ public class ConnectorEditPart extends UMLConnectionNodeEditPart implements ITre
*/
protected boolean addFixedChild(EditPart childEditPart) {
if (childEditPart instanceof ConnectorAppliedStereotypeEditPart) {
- ((ConnectorAppliedStereotypeEditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
+ ((ConnectorAppliedStereotypeEditPart) childEditPart).setLabel(
+ getPrimaryShape().getAppliedStereotypeLabel());
}
if (childEditPart instanceof ConnectorNameEditPart) {
- ((ConnectorNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ ((ConnectorNameEditPart) childEditPart).setLabel(
+ getPrimaryShape().getNameLabel());
}
return false;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConnectorNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConnectorNameEditPart.java
index 3aee3afac1c..c1a768651d7 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConnectorNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConnectorNameEditPart.java
@@ -1,789 +1,828 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.component.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.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.component.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.component.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 ConnectorNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 6025;
-
- /**
- * @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.component.edit.parts.ConnectorNameEditPart.VISUAL_ID), new Point(0, -20));
- }
-
- /**
- * @generated
- */
- public ConnectorNameEditPart(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());
- }
-
- /**
- * @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
- */
- 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.Connector_4019, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.edit.parts.ConnectorNameEditPart.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() {
- // 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.component.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.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.component.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.component.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 ConnectorNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6025;
+
+ /**
+ * @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.component.edit.parts.ConnectorNameEditPart.VISUAL_ID), new Point(0, -20));
+ }
+
+ /**
+ * @generated
+ */
+ public ConnectorNameEditPart(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.Connector_4019, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.edit.parts.ConnectorNameEditPart.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() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintEditPart.java
index fb6850942e9..027fc139adf 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintEditPart.java
@@ -116,6 +116,7 @@ public class ConstraintEditPart extends AbstractConstraintEditPart {
@Override
protected void handleNotificationEvent(Notification event) {
super.handleNotificationEvent(event);
+
}
/**
@@ -148,6 +149,8 @@ public class ConstraintEditPart extends AbstractConstraintEditPart {
((ConstraintSpecificationEditPart) childEditPart).setLabel(getPrimaryShape().getConstraintFigure());
return true;
}
+
+
return false;
}
@@ -214,6 +217,7 @@ public class ConstraintEditPart extends AbstractConstraintEditPart {
@Override
protected NodeFigure createNodeFigure() {
return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintEditPartPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintEditPartPCN.java
index d9b864cd3c2..adcf37463f5 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintEditPartPCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintEditPartPCN.java
@@ -116,6 +116,7 @@ public class ConstraintEditPartPCN extends AbstractConstraintEditPart {
@Override
protected void handleNotificationEvent(Notification event) {
super.handleNotificationEvent(event);
+
}
/**
@@ -148,6 +149,8 @@ public class ConstraintEditPartPCN extends AbstractConstraintEditPart {
((ConstraintSpecificationEditPartPCN) childEditPart).setLabel(getPrimaryShape().getConstraintFigure());
return true;
}
+
+
return false;
}
@@ -214,6 +217,7 @@ public class ConstraintEditPartPCN extends AbstractConstraintEditPart {
@Override
protected NodeFigure createNodeFigure() {
return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintNameEditPart.java
index 00bee622dde..69362f54eaf 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintNameEditPart.java
@@ -199,7 +199,8 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -262,7 +263,9 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
@@ -294,7 +297,9 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -317,18 +322,21 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement
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));
- }
- });
+ 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;
}
@@ -370,7 +378,9 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement
*/
protected DirectEditManager getManager() {
if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -420,7 +430,9 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement
*/
@Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
+
if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
@@ -432,7 +444,9 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement
updateExtendedEditorConfiguration();
if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
performDefaultDirectEditorEdit(theRequest);
} else {
configuration.preEditAction(resolveSemanticElement());
@@ -445,14 +459,17 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement
IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ }
+ 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);
+ 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") {
@@ -460,6 +477,7 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement
@Override
protected void doExecute() {
configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -481,14 +499,15 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement
// 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) {
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -525,7 +544,8 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement
if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
@@ -544,14 +564,17 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement
* @generated
*/
protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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 {
+ }
+ else {
((WrappingLabel) getFigure()).setTextUnderline(false);
}
}
@@ -561,7 +584,9 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ FontStyle style =
+ (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
@@ -572,9 +597,14 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement
*/
@Override
protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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));
+ FontData fontData = new FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
+ (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
@@ -655,6 +685,7 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement
if (checkDefaultEdition()) {
return IDirectEdition.DEFAULT_DIRECT_EDITOR;
}
+
// not a named element. no specific editor => do nothing
return IDirectEdition.NO_DIRECT_EDITION;
}
@@ -704,9 +735,11 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement
* @generated
*/
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ 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());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
+ .eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
@@ -728,7 +761,8 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement
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);
+ 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;
@@ -776,15 +810,18 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement
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)) {
+ } 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();
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
@@ -827,7 +864,8 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement
* @generated
*/
protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
}
/**
@@ -837,6 +875,7 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement
public void deactivate() {
removeOwnerElementListeners();
super.deactivate();
+
}
/**
@@ -844,5 +883,6 @@ public class ConstraintNameEditPart extends PapyrusCompartmentEditPart implement
*/
protected void removeOwnerElementListeners() {
removeListenerFilter(ADD_PARENT_MODEL);
+
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintNameEditPartPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintNameEditPartPCN.java
index 57a214c6437..f0f87e9cd78 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintNameEditPartPCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintNameEditPartPCN.java
@@ -199,7 +199,8 @@ public class ConstraintNameEditPartPCN extends PapyrusCompartmentEditPart implem
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -262,7 +263,9 @@ public class ConstraintNameEditPartPCN extends PapyrusCompartmentEditPart implem
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
@@ -294,7 +297,9 @@ public class ConstraintNameEditPartPCN extends PapyrusCompartmentEditPart implem
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -317,18 +322,21 @@ public class ConstraintNameEditPartPCN extends PapyrusCompartmentEditPart implem
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));
- }
- });
+ 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;
}
@@ -370,7 +378,9 @@ public class ConstraintNameEditPartPCN extends PapyrusCompartmentEditPart implem
*/
protected DirectEditManager getManager() {
if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -420,7 +430,9 @@ public class ConstraintNameEditPartPCN extends PapyrusCompartmentEditPart implem
*/
@Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
+
if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
@@ -432,7 +444,9 @@ public class ConstraintNameEditPartPCN extends PapyrusCompartmentEditPart implem
updateExtendedEditorConfiguration();
if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
performDefaultDirectEditorEdit(theRequest);
} else {
configuration.preEditAction(resolveSemanticElement());
@@ -445,14 +459,17 @@ public class ConstraintNameEditPartPCN extends PapyrusCompartmentEditPart implem
IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ }
+ 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);
+ 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") {
@@ -460,6 +477,7 @@ public class ConstraintNameEditPartPCN extends PapyrusCompartmentEditPart implem
@Override
protected void doExecute() {
configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -481,14 +499,15 @@ public class ConstraintNameEditPartPCN extends PapyrusCompartmentEditPart implem
// 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) {
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -525,7 +544,8 @@ public class ConstraintNameEditPartPCN extends PapyrusCompartmentEditPart implem
if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
@@ -544,14 +564,17 @@ public class ConstraintNameEditPartPCN extends PapyrusCompartmentEditPart implem
* @generated
*/
protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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 {
+ }
+ else {
((WrappingLabel) getFigure()).setTextUnderline(false);
}
}
@@ -561,7 +584,9 @@ public class ConstraintNameEditPartPCN extends PapyrusCompartmentEditPart implem
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ FontStyle style =
+ (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
@@ -572,9 +597,14 @@ public class ConstraintNameEditPartPCN extends PapyrusCompartmentEditPart implem
*/
@Override
protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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));
+ FontData fontData = new FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
+ (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
@@ -655,6 +685,7 @@ public class ConstraintNameEditPartPCN extends PapyrusCompartmentEditPart implem
if (checkDefaultEdition()) {
return IDirectEdition.DEFAULT_DIRECT_EDITOR;
}
+
// not a named element. no specific editor => do nothing
return IDirectEdition.NO_DIRECT_EDITION;
}
@@ -704,9 +735,11 @@ public class ConstraintNameEditPartPCN extends PapyrusCompartmentEditPart implem
* @generated
*/
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ 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());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
+ .eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
@@ -728,7 +761,8 @@ public class ConstraintNameEditPartPCN extends PapyrusCompartmentEditPart implem
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);
+ 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;
@@ -776,15 +810,18 @@ public class ConstraintNameEditPartPCN extends PapyrusCompartmentEditPart implem
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)) {
+ } 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();
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
@@ -827,7 +864,8 @@ public class ConstraintNameEditPartPCN extends PapyrusCompartmentEditPart implem
* @generated
*/
protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
}
/**
@@ -837,6 +875,7 @@ public class ConstraintNameEditPartPCN extends PapyrusCompartmentEditPart implem
public void deactivate() {
removeOwnerElementListeners();
super.deactivate();
+
}
/**
@@ -844,5 +883,6 @@ public class ConstraintNameEditPartPCN extends PapyrusCompartmentEditPart implem
*/
protected void removeOwnerElementListeners() {
removeListenerFilter(ADD_PARENT_MODEL);
+
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintSpecificationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintSpecificationEditPart.java
index ecdbd2b3b6d..d0fa27f18be 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintSpecificationEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintSpecificationEditPart.java
@@ -199,7 +199,8 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -262,7 +263,9 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
@@ -294,7 +297,9 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -317,18 +322,21 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart
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));
- }
- });
+ 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;
}
@@ -370,7 +378,9 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart
*/
protected DirectEditManager getManager() {
if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -420,7 +430,9 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart
*/
@Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
+
if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
@@ -432,7 +444,9 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart
updateExtendedEditorConfiguration();
if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
performDefaultDirectEditorEdit(theRequest);
} else {
configuration.preEditAction(resolveSemanticElement());
@@ -445,14 +459,17 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart
IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ }
+ 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);
+ 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") {
@@ -460,6 +477,7 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart
@Override
protected void doExecute() {
configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -481,14 +499,15 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart
// 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) {
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -525,7 +544,8 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart
if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
@@ -544,14 +564,17 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart
* @generated
*/
protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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 {
+ }
+ else {
((WrappingLabel) getFigure()).setTextUnderline(false);
}
}
@@ -561,7 +584,9 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ FontStyle style =
+ (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
@@ -572,9 +597,14 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart
*/
@Override
protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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));
+ FontData fontData = new FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
+ (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
@@ -655,6 +685,7 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart
if (checkDefaultEdition()) {
return IDirectEdition.DEFAULT_DIRECT_EDITOR;
}
+
// not a named element. no specific editor => do nothing
return IDirectEdition.NO_DIRECT_EDITION;
}
@@ -704,9 +735,11 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart
* @generated
*/
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ 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());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
+ .eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
@@ -728,7 +761,8 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart
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);
+ 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;
@@ -776,15 +810,18 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart
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)) {
+ } 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();
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
@@ -827,7 +864,8 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart
* @generated
*/
protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
}
/**
@@ -837,6 +875,7 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart
public void deactivate() {
removeOwnerElementListeners();
super.deactivate();
+
}
/**
@@ -844,5 +883,6 @@ public class ConstraintSpecificationEditPart extends PapyrusCompartmentEditPart
*/
protected void removeOwnerElementListeners() {
removeListenerFilter(ADD_PARENT_MODEL);
+
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintSpecificationEditPartPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintSpecificationEditPartPCN.java
index 08db9bf6670..3758101316d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintSpecificationEditPartPCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ConstraintSpecificationEditPartPCN.java
@@ -199,7 +199,8 @@ public class ConstraintSpecificationEditPartPCN extends PapyrusCompartmentEditPa
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -262,7 +263,9 @@ public class ConstraintSpecificationEditPartPCN extends PapyrusCompartmentEditPa
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
@@ -294,7 +297,9 @@ public class ConstraintSpecificationEditPartPCN extends PapyrusCompartmentEditPa
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -317,18 +322,21 @@ public class ConstraintSpecificationEditPartPCN extends PapyrusCompartmentEditPa
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));
- }
- });
+ 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;
}
@@ -370,7 +378,9 @@ public class ConstraintSpecificationEditPartPCN extends PapyrusCompartmentEditPa
*/
protected DirectEditManager getManager() {
if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -420,7 +430,9 @@ public class ConstraintSpecificationEditPartPCN extends PapyrusCompartmentEditPa
*/
@Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
+
if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
@@ -432,7 +444,9 @@ public class ConstraintSpecificationEditPartPCN extends PapyrusCompartmentEditPa
updateExtendedEditorConfiguration();
if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
performDefaultDirectEditorEdit(theRequest);
} else {
configuration.preEditAction(resolveSemanticElement());
@@ -445,14 +459,17 @@ public class ConstraintSpecificationEditPartPCN extends PapyrusCompartmentEditPa
IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ }
+ 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);
+ 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") {
@@ -460,6 +477,7 @@ public class ConstraintSpecificationEditPartPCN extends PapyrusCompartmentEditPa
@Override
protected void doExecute() {
configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -481,14 +499,15 @@ public class ConstraintSpecificationEditPartPCN extends PapyrusCompartmentEditPa
// 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) {
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -525,7 +544,8 @@ public class ConstraintSpecificationEditPartPCN extends PapyrusCompartmentEditPa
if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
@@ -544,14 +564,17 @@ public class ConstraintSpecificationEditPartPCN extends PapyrusCompartmentEditPa
* @generated
*/
protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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 {
+ }
+ else {
((WrappingLabel) getFigure()).setTextUnderline(false);
}
}
@@ -561,7 +584,9 @@ public class ConstraintSpecificationEditPartPCN extends PapyrusCompartmentEditPa
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ FontStyle style =
+ (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
@@ -572,9 +597,14 @@ public class ConstraintSpecificationEditPartPCN extends PapyrusCompartmentEditPa
*/
@Override
protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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));
+ FontData fontData = new FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
+ (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
@@ -655,6 +685,7 @@ public class ConstraintSpecificationEditPartPCN extends PapyrusCompartmentEditPa
if (checkDefaultEdition()) {
return IDirectEdition.DEFAULT_DIRECT_EDITOR;
}
+
// not a named element. no specific editor => do nothing
return IDirectEdition.NO_DIRECT_EDITION;
}
@@ -704,9 +735,11 @@ public class ConstraintSpecificationEditPartPCN extends PapyrusCompartmentEditPa
* @generated
*/
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ 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());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
+ .eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
@@ -728,7 +761,8 @@ public class ConstraintSpecificationEditPartPCN extends PapyrusCompartmentEditPa
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);
+ 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;
@@ -776,15 +810,18 @@ public class ConstraintSpecificationEditPartPCN extends PapyrusCompartmentEditPa
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)) {
+ } 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();
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
@@ -827,7 +864,8 @@ public class ConstraintSpecificationEditPartPCN extends PapyrusCompartmentEditPa
* @generated
*/
protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
}
/**
@@ -837,6 +875,7 @@ public class ConstraintSpecificationEditPartPCN extends PapyrusCompartmentEditPa
public void deactivate() {
removeOwnerElementListeners();
super.deactivate();
+
}
/**
@@ -844,5 +883,6 @@ public class ConstraintSpecificationEditPartPCN extends PapyrusCompartmentEditPa
*/
protected void removeOwnerElementListeners() {
removeListenerFilter(ADD_PARENT_MODEL);
+
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DefaultNamedElementEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DefaultNamedElementEditPart.java
index fbfd6a62659..dbf07eaf791 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DefaultNamedElementEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DefaultNamedElementEditPart.java
@@ -138,6 +138,8 @@ public class DefaultNamedElementEditPart extends NodeEditPart {
((DefaultNamedElementNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
return true;
}
+
+
return false;
}
@@ -201,6 +203,7 @@ public class DefaultNamedElementEditPart extends NodeEditPart {
@Override
protected NodeFigure createNodeFigure() {
return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DefaultNamedElementNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DefaultNamedElementNameEditPart.java
index c60f315a198..343e0122337 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DefaultNamedElementNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DefaultNamedElementNameEditPart.java
@@ -195,7 +195,8 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -248,7 +249,9 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
@@ -280,7 +283,9 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -303,18 +308,21 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart
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));
- }
- });
+ 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;
}
@@ -356,7 +364,9 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart
*/
protected DirectEditManager getManager() {
if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -406,7 +416,9 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart
*/
@Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
+
if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
@@ -418,7 +430,9 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart
updateExtendedEditorConfiguration();
if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
performDefaultDirectEditorEdit(theRequest);
} else {
configuration.preEditAction(resolveSemanticElement());
@@ -431,14 +445,17 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart
IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ }
+ 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);
+ 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") {
@@ -446,6 +463,7 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart
@Override
protected void doExecute() {
configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -467,14 +485,15 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart
// 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) {
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -511,7 +530,8 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart
if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
@@ -530,14 +550,17 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart
* @generated
*/
protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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 {
+ }
+ else {
((WrappingLabel) getFigure()).setTextUnderline(false);
}
}
@@ -547,7 +570,9 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ FontStyle style =
+ (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
@@ -558,9 +583,14 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart
*/
@Override
protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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));
+ FontData fontData = new FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
+ (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
@@ -641,6 +671,7 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart
if (checkDefaultEdition()) {
return IDirectEdition.DEFAULT_DIRECT_EDITOR;
}
+
// not a named element. no specific editor => do nothing
return IDirectEdition.NO_DIRECT_EDITION;
}
@@ -690,9 +721,11 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart
* @generated
*/
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ 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());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
+ .eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
@@ -714,7 +747,8 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart
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);
+ 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;
@@ -762,15 +796,18 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart
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)) {
+ } 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();
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
@@ -810,7 +847,8 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart
* @generated
*/
protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
}
/**
@@ -820,6 +858,7 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart
public void deactivate() {
removeOwnerElementListeners();
super.deactivate();
+
}
/**
@@ -827,5 +866,6 @@ public class DefaultNamedElementNameEditPart extends PapyrusCompartmentEditPart
*/
protected void removeOwnerElementListeners() {
removeListenerFilter(ADD_PARENT_MODEL);
+
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DependencyAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DependencyAppliedStereotypeEditPart.java
index 3e914941224..f5949039246 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DependencyAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DependencyAppliedStereotypeEditPart.java
@@ -1,782 +1,820 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.component.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.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.component.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.component.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 {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 6023;
-
- /**
- * @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.component.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());
- }
-
- /**
- * @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
- */
- 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.Dependency_4010, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.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) {
- 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() {
- // 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.component.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.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.component.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.component.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 {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6023;
+
+ /**
+ * @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.component.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 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.Dependency_4010, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.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) {
+ 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() {
+ // 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;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DependencyEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DependencyEditPart.java
index 0597a0c5fbc..640b91e4a89 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DependencyEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DependencyEditPart.java
@@ -59,10 +59,12 @@ public class DependencyEditPart extends UMLConnectionNodeEditPart implements ITr
*/
protected boolean addFixedChild(EditPart childEditPart) {
if (childEditPart instanceof DependencyNameEditPart) {
- ((DependencyNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ ((DependencyNameEditPart) childEditPart).setLabel(
+ getPrimaryShape().getNameLabel());
}
if (childEditPart instanceof DependencyAppliedStereotypeEditPart) {
- ((DependencyAppliedStereotypeEditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
+ ((DependencyAppliedStereotypeEditPart) childEditPart).setLabel(
+ getPrimaryShape().getAppliedStereotypeLabel());
}
return false;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DependencyNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DependencyNameEditPart.java
index e862e2b798a..72cdf5c336c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DependencyNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DependencyNameEditPart.java
@@ -1,789 +1,828 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.component.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.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.component.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.component.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 = 6009;
-
- /**
- * @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.component.edit.parts.DependencyNameEditPart.VISUAL_ID), new Point(0, 60));
- }
-
- /**
- * @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());
- }
-
- /**
- * @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
- */
- 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_4010, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.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) {
- 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() {
- // 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.component.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.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.component.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.component.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 = 6009;
+
+ /**
+ * @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.component.edit.parts.DependencyNameEditPart.VISUAL_ID), new Point(0, 60));
+ }
+
+ /**
+ * @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_4010, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.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) {
+ 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() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DependencyNodeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DependencyNodeEditPart.java
index 3de5f1d243d..2d146cf628d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DependencyNodeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/DependencyNodeEditPart.java
@@ -102,7 +102,8 @@ public class DependencyNodeEditPart extends NodeEditPart {
mh.setBorder(null);
return Collections.singletonList(mh);
}
- };
+ }
+ ;
}
EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
if (result == null) {
@@ -150,7 +151,8 @@ public class DependencyNodeEditPart extends NodeEditPart {
if (borderItemEditPart instanceof MultiDependencyLabelEditPart) {
IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else {
+ } else
+ {
super.addBorderItem(borderItemContainer, borderItemEditPart);
}
}
@@ -175,6 +177,7 @@ public class DependencyNodeEditPart extends NodeEditPart {
@Override
protected NodeFigure createMainFigure() {
return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/GeneralizationAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/GeneralizationAppliedStereotypeEditPart.java
index 98bce3cec46..e63ef9a2606 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/GeneralizationAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/GeneralizationAppliedStereotypeEditPart.java
@@ -1,782 +1,820 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.component.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.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.component.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.component.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 {
-
- /**
- * @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
- */
- static {
- registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.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());
- }
-
- /**
- * @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
- */
- 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.component.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) {
- 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() {
- // 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.component.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.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.component.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.component.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 {
+
+ /**
+ * @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
+ */
+ static {
+ registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.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.component.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) {
+ 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() {
+ // 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;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/GeneralizationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/GeneralizationEditPart.java
index 0fc03aa5049..2799eef9936 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/GeneralizationEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/GeneralizationEditPart.java
@@ -59,7 +59,8 @@ public class GeneralizationEditPart extends UMLConnectionNodeEditPart implements
*/
protected boolean addFixedChild(EditPart childEditPart) {
if (childEditPart instanceof GeneralizationAppliedStereotypeEditPart) {
- ((GeneralizationAppliedStereotypeEditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
+ ((GeneralizationAppliedStereotypeEditPart) childEditPart).setLabel(
+ getPrimaryShape().getAppliedStereotypeLabel());
}
return false;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceAttributeCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceAttributeCompartmentEditPart.java
index a0dbd4b6dae..be6807690db 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceAttributeCompartmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceAttributeCompartmentEditPart.java
@@ -76,8 +76,9 @@ public class InterfaceAttributeCompartmentEditPart extends ResizeableListCompart
installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.edit.policies.InterfaceAttributeCompartmentCanonicalEditPolicy());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.edit.policies.InterfaceAttributeCompartmentCanonicalEditPolicy());
+
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
}
@@ -96,6 +97,7 @@ public class InterfaceAttributeCompartmentEditPart extends ResizeableListCompart
*/
@Override
public EditPart getTargetEditPart(Request request) {
+
return super.getTargetEditPart(request);
}
@@ -105,7 +107,10 @@ public class InterfaceAttributeCompartmentEditPart extends ResizeableListCompart
@Override
protected void handleNotificationEvent(Notification notification) {
Object feature = notification.getFeature();
- if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ if (NotationPackage.eINSTANCE.getSize_Width().equals(feature)
+ || NotationPackage.eINSTANCE.getSize_Height().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_X().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
refreshBounds();
}
super.handleNotificationEvent(notification);
@@ -122,7 +127,10 @@ public class InterfaceAttributeCompartmentEditPart extends ResizeableListCompart
int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
Point loc = new Point(x, y);
- ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(
+ this,
+ getFigure(),
+ new Rectangle(loc, size));
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceAttributeCompartmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceAttributeCompartmentEditPartCN.java
index 6c115175203..1abaa510634 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceAttributeCompartmentEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceAttributeCompartmentEditPartCN.java
@@ -76,8 +76,9 @@ public class InterfaceAttributeCompartmentEditPartCN extends ListCompartmentEdit
installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.edit.policies.InterfaceAttributeCompartmentCanonicalEditPolicyCN());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.edit.policies.InterfaceAttributeCompartmentCanonicalEditPolicyCN());
+
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
}
@@ -96,6 +97,7 @@ public class InterfaceAttributeCompartmentEditPartCN extends ListCompartmentEdit
*/
@Override
public EditPart getTargetEditPart(Request request) {
+
return super.getTargetEditPart(request);
}
@@ -105,7 +107,10 @@ public class InterfaceAttributeCompartmentEditPartCN extends ListCompartmentEdit
@Override
protected void handleNotificationEvent(Notification notification) {
Object feature = notification.getFeature();
- if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ if (NotationPackage.eINSTANCE.getSize_Width().equals(feature)
+ || NotationPackage.eINSTANCE.getSize_Height().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_X().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
refreshBounds();
}
super.handleNotificationEvent(notification);
@@ -121,7 +126,10 @@ public class InterfaceAttributeCompartmentEditPartCN extends ListCompartmentEdit
int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
Point loc = new Point(x, y);
- ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(
+ this,
+ getFigure(),
+ new Rectangle(loc, size));
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceEditPart.java
index e380ff0d889..019d287dc7a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceEditPart.java
@@ -102,7 +102,8 @@ public class InterfaceEditPart extends NodeEditPart {
mh.setBorder(null);
return Collections.singletonList(mh);
}
- };
+ }
+ ;
}
EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
if (result == null) {
@@ -150,7 +151,8 @@ public class InterfaceEditPart extends NodeEditPart {
if (borderItemEditPart instanceof InterfaceNameEditPart) {
IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else {
+ } else
+ {
super.addBorderItem(borderItemContainer, borderItemEditPart);
}
}
@@ -175,6 +177,7 @@ public class InterfaceEditPart extends NodeEditPart {
@Override
protected NodeFigure createMainFigure() {
return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceEditPartPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceEditPartPCN.java
index 29d5d3544a5..afe3e1f9514 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceEditPartPCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceEditPartPCN.java
@@ -104,7 +104,8 @@ public class InterfaceEditPartPCN extends NodeEditPart {
mh.setBorder(null);
return Collections.singletonList(mh);
}
- };
+ }
+ ;
}
EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
if (result == null) {
@@ -152,7 +153,8 @@ public class InterfaceEditPartPCN extends NodeEditPart {
if (borderItemEditPart instanceof InterfaceNameEditPartPCN) {
IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else {
+ } else
+ {
super.addBorderItem(borderItemContainer, borderItemEditPart);
}
}
@@ -177,6 +179,7 @@ public class InterfaceEditPartPCN extends NodeEditPart {
@Override
protected NodeFigure createMainFigure() {
return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceNameEditPart.java
index fe208eaa977..3a66901ec4d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceNameEditPart.java
@@ -34,7 +34,6 @@ import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
@@ -60,6 +59,7 @@ import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
@@ -84,7 +84,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class InterfaceNameEditPart extends LabelEditPart implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider {
+public class InterfaceNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider {
/**
* @generated
@@ -228,7 +228,8 @@ public class InterfaceNameEditPart extends LabelEditPart implements ITextAwareEd
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -280,7 +281,9 @@ public class InterfaceNameEditPart extends LabelEditPart implements ITextAwareEd
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
@@ -312,7 +315,9 @@ public class InterfaceNameEditPart extends LabelEditPart implements ITextAwareEd
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -335,18 +340,21 @@ public class InterfaceNameEditPart extends LabelEditPart implements ITextAwareEd
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));
- }
- });
+ 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;
}
@@ -388,7 +396,9 @@ public class InterfaceNameEditPart extends LabelEditPart implements ITextAwareEd
*/
protected DirectEditManager getManager() {
if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -438,7 +448,9 @@ public class InterfaceNameEditPart extends LabelEditPart implements ITextAwareEd
*/
@Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
+
if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
@@ -450,7 +462,9 @@ public class InterfaceNameEditPart extends LabelEditPart implements ITextAwareEd
updateExtendedEditorConfiguration();
if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
performDefaultDirectEditorEdit(theRequest);
} else {
configuration.preEditAction(resolveSemanticElement());
@@ -463,14 +477,17 @@ public class InterfaceNameEditPart extends LabelEditPart implements ITextAwareEd
IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ }
+ 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);
+ 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") {
@@ -478,6 +495,7 @@ public class InterfaceNameEditPart extends LabelEditPart implements ITextAwareEd
@Override
protected void doExecute() {
configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -499,14 +517,15 @@ public class InterfaceNameEditPart extends LabelEditPart implements ITextAwareEd
// 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) {
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -543,7 +562,8 @@ public class InterfaceNameEditPart extends LabelEditPart implements ITextAwareEd
if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
@@ -562,14 +582,17 @@ public class InterfaceNameEditPart extends LabelEditPart implements ITextAwareEd
* @generated
*/
protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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 {
+ }
+ else {
((WrappingLabel) getFigure()).setTextUnderline(false);
}
}
@@ -579,7 +602,9 @@ public class InterfaceNameEditPart extends LabelEditPart implements ITextAwareEd
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ FontStyle style =
+ (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
@@ -590,9 +615,14 @@ public class InterfaceNameEditPart extends LabelEditPart implements ITextAwareEd
*/
@Override
protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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));
+ FontData fontData = new FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
+ (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
@@ -673,6 +703,7 @@ public class InterfaceNameEditPart extends LabelEditPart implements ITextAwareEd
if (checkDefaultEdition()) {
return IDirectEdition.DEFAULT_DIRECT_EDITOR;
}
+
// not a named element. no specific editor => do nothing
return IDirectEdition.NO_DIRECT_EDITION;
}
@@ -722,9 +753,11 @@ public class InterfaceNameEditPart extends LabelEditPart implements ITextAwareEd
* @generated
*/
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ 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());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
+ .eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
@@ -746,7 +779,8 @@ public class InterfaceNameEditPart extends LabelEditPart implements ITextAwareEd
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);
+ 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;
@@ -775,15 +809,18 @@ public class InterfaceNameEditPart extends LabelEditPart implements ITextAwareEd
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)) {
+ } 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();
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceNameEditPartPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceNameEditPartPCN.java
index 313ce11af29..21f8856b7ec 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceNameEditPartPCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceNameEditPartPCN.java
@@ -34,7 +34,6 @@ import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
@@ -60,6 +59,7 @@ import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
@@ -84,7 +84,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class InterfaceNameEditPartPCN extends LabelEditPart implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider {
+public class InterfaceNameEditPartPCN extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider {
/**
* @generated
@@ -228,7 +228,8 @@ public class InterfaceNameEditPartPCN extends LabelEditPart implements ITextAwar
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -280,7 +281,9 @@ public class InterfaceNameEditPartPCN extends LabelEditPart implements ITextAwar
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
@@ -312,7 +315,9 @@ public class InterfaceNameEditPartPCN extends LabelEditPart implements ITextAwar
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -335,18 +340,21 @@ public class InterfaceNameEditPartPCN extends LabelEditPart implements ITextAwar
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));
- }
- });
+ 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;
}
@@ -388,7 +396,9 @@ public class InterfaceNameEditPartPCN extends LabelEditPart implements ITextAwar
*/
protected DirectEditManager getManager() {
if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -438,7 +448,9 @@ public class InterfaceNameEditPartPCN extends LabelEditPart implements ITextAwar
*/
@Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
+
if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
@@ -450,7 +462,9 @@ public class InterfaceNameEditPartPCN extends LabelEditPart implements ITextAwar
updateExtendedEditorConfiguration();
if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
performDefaultDirectEditorEdit(theRequest);
} else {
configuration.preEditAction(resolveSemanticElement());
@@ -463,14 +477,17 @@ public class InterfaceNameEditPartPCN extends LabelEditPart implements ITextAwar
IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ }
+ 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);
+ 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") {
@@ -478,6 +495,7 @@ public class InterfaceNameEditPartPCN extends LabelEditPart implements ITextAwar
@Override
protected void doExecute() {
configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -499,14 +517,15 @@ public class InterfaceNameEditPartPCN extends LabelEditPart implements ITextAwar
// 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) {
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -543,7 +562,8 @@ public class InterfaceNameEditPartPCN extends LabelEditPart implements ITextAwar
if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
@@ -562,14 +582,17 @@ public class InterfaceNameEditPartPCN extends LabelEditPart implements ITextAwar
* @generated
*/
protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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 {
+ }
+ else {
((WrappingLabel) getFigure()).setTextUnderline(false);
}
}
@@ -579,7 +602,9 @@ public class InterfaceNameEditPartPCN extends LabelEditPart implements ITextAwar
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ FontStyle style =
+ (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
@@ -590,9 +615,14 @@ public class InterfaceNameEditPartPCN extends LabelEditPart implements ITextAwar
*/
@Override
protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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));
+ FontData fontData = new FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
+ (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
@@ -673,6 +703,7 @@ public class InterfaceNameEditPartPCN extends LabelEditPart implements ITextAwar
if (checkDefaultEdition()) {
return IDirectEdition.DEFAULT_DIRECT_EDITOR;
}
+
// not a named element. no specific editor => do nothing
return IDirectEdition.NO_DIRECT_EDITION;
}
@@ -722,9 +753,11 @@ public class InterfaceNameEditPartPCN extends LabelEditPart implements ITextAwar
* @generated
*/
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ 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());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
+ .eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
@@ -746,7 +779,8 @@ public class InterfaceNameEditPartPCN extends LabelEditPart implements ITextAwar
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);
+ 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;
@@ -775,15 +809,18 @@ public class InterfaceNameEditPartPCN extends LabelEditPart implements ITextAwar
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)) {
+ } 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();
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceOperationCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceOperationCompartmentEditPart.java
index ded647d66f9..2cd876ac541 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceOperationCompartmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceOperationCompartmentEditPart.java
@@ -76,8 +76,9 @@ public class InterfaceOperationCompartmentEditPart extends ResizeableListCompart
installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.edit.policies.InterfaceOperationCompartmentCanonicalEditPolicy());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.edit.policies.InterfaceOperationCompartmentCanonicalEditPolicy());
+
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
}
@@ -96,6 +97,7 @@ public class InterfaceOperationCompartmentEditPart extends ResizeableListCompart
*/
@Override
public EditPart getTargetEditPart(Request request) {
+
return super.getTargetEditPart(request);
}
@@ -105,7 +107,10 @@ public class InterfaceOperationCompartmentEditPart extends ResizeableListCompart
@Override
protected void handleNotificationEvent(Notification notification) {
Object feature = notification.getFeature();
- if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ if (NotationPackage.eINSTANCE.getSize_Width().equals(feature)
+ || NotationPackage.eINSTANCE.getSize_Height().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_X().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
refreshBounds();
}
super.handleNotificationEvent(notification);
@@ -122,7 +127,10 @@ public class InterfaceOperationCompartmentEditPart extends ResizeableListCompart
int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
Point loc = new Point(x, y);
- ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(
+ this,
+ getFigure(),
+ new Rectangle(loc, size));
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceOperationCompartmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceOperationCompartmentEditPartCN.java
index c0537daddae..e92efd9f315 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceOperationCompartmentEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/InterfaceOperationCompartmentEditPartCN.java
@@ -76,8 +76,9 @@ public class InterfaceOperationCompartmentEditPartCN extends ListCompartmentEdit
installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.edit.policies.InterfaceOperationCompartmentCanonicalEditPolicyCN());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.edit.policies.InterfaceOperationCompartmentCanonicalEditPolicyCN());
+
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
}
@@ -96,6 +97,7 @@ public class InterfaceOperationCompartmentEditPartCN extends ListCompartmentEdit
*/
@Override
public EditPart getTargetEditPart(Request request) {
+
return super.getTargetEditPart(request);
}
@@ -105,7 +107,10 @@ public class InterfaceOperationCompartmentEditPartCN extends ListCompartmentEdit
@Override
protected void handleNotificationEvent(Notification notification) {
Object feature = notification.getFeature();
- if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ if (NotationPackage.eINSTANCE.getSize_Width().equals(feature)
+ || NotationPackage.eINSTANCE.getSize_Height().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_X().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
refreshBounds();
}
super.handleNotificationEvent(notification);
@@ -121,7 +126,10 @@ public class InterfaceOperationCompartmentEditPartCN extends ListCompartmentEdit
int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
Point loc = new Point(x, y);
- ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(
+ this,
+ getFigure(),
+ new Rectangle(loc, size));
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ManifestationAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ManifestationAppliedStereotypeEditPart.java
index 461d354c18e..1bb463c2d2e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ManifestationAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ManifestationAppliedStereotypeEditPart.java
@@ -1,789 +1,828 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.component.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.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.component.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.component.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 {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 6022;
-
- /**
- * @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.component.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());
- }
-
- /**
- * @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
- */
- 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_4014, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.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) {
- 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() {
- // 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.component.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.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.component.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.component.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 {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6022;
+
+ /**
+ * @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.component.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_4014, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.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) {
+ 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() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ManifestationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ManifestationEditPart.java
index 34a6c186553..f28052c028d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ManifestationEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ManifestationEditPart.java
@@ -59,10 +59,12 @@ public class ManifestationEditPart extends UMLConnectionNodeEditPart implements
*/
protected boolean addFixedChild(EditPart childEditPart) {
if (childEditPart instanceof ManifestationNameEditPart) {
- ((ManifestationNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ ((ManifestationNameEditPart) childEditPart).setLabel(
+ getPrimaryShape().getNameLabel());
}
if (childEditPart instanceof ManifestationAppliedStereotypeEditPart) {
- ((ManifestationAppliedStereotypeEditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
+ ((ManifestationAppliedStereotypeEditPart) childEditPart).setLabel(
+ getPrimaryShape().getAppliedStereotypeLabel());
}
return false;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ManifestationNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ManifestationNameEditPart.java
index ef4e38dafc6..54c953ad1e2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ManifestationNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ManifestationNameEditPart.java
@@ -1,789 +1,828 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.component.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.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.component.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.component.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 = 6008;
-
- /**
- * @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.component.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());
- }
-
- /**
- * @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
- */
- 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_4014, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.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) {
- 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() {
- // 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.component.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.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.component.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.component.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 = 6008;
+
+ /**
+ * @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.component.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_4014, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.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) {
+ 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() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelEditPart.java
index 7661a9994e9..b4cc8dbdb38 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelEditPart.java
@@ -120,6 +120,7 @@ public class ModelEditPart extends NamedElementEditPart {
@Override
protected void handleNotificationEvent(Notification event) {
super.handleNotificationEvent(event);
+
}
/**
@@ -148,12 +149,15 @@ public class ModelEditPart extends NamedElementEditPart {
((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;
}
@@ -225,6 +229,7 @@ public class ModelEditPart extends NamedElementEditPart {
@Override
protected NodeFigure createNodeFigure() {
return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelEditPartCN.java
index 8082c7d4564..ebd21589d83 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelEditPartCN.java
@@ -137,12 +137,15 @@ public class ModelEditPartCN extends NodeEditPart {
((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;
}
@@ -214,6 +217,7 @@ public class ModelEditPartCN extends NodeEditPart {
@Override
protected NodeFigure createNodeFigure() {
return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelNameEditPart.java
index a2381c0bd08..3a3d4ddd8fa 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelNameEditPart.java
@@ -199,7 +199,8 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -262,7 +263,9 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
@@ -294,7 +297,9 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -317,18 +322,21 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe
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));
- }
- });
+ 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;
}
@@ -370,7 +378,9 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe
*/
protected DirectEditManager getManager() {
if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -420,7 +430,9 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe
*/
@Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
+
if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
@@ -432,7 +444,9 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe
updateExtendedEditorConfiguration();
if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
performDefaultDirectEditorEdit(theRequest);
} else {
configuration.preEditAction(resolveSemanticElement());
@@ -445,14 +459,17 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe
IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ }
+ 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);
+ 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") {
@@ -460,6 +477,7 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe
@Override
protected void doExecute() {
configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -481,14 +499,15 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe
// 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) {
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -525,7 +544,8 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe
if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
@@ -544,14 +564,17 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe
* @generated
*/
protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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 {
+ }
+ else {
((WrappingLabel) getFigure()).setTextUnderline(false);
}
}
@@ -561,7 +584,9 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ FontStyle style =
+ (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
@@ -572,9 +597,14 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe
*/
@Override
protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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));
+ FontData fontData = new FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
+ (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
@@ -655,6 +685,7 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe
if (checkDefaultEdition()) {
return IDirectEdition.DEFAULT_DIRECT_EDITOR;
}
+
// not a named element. no specific editor => do nothing
return IDirectEdition.NO_DIRECT_EDITION;
}
@@ -704,9 +735,11 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe
* @generated
*/
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ 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());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
+ .eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
@@ -728,7 +761,8 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe
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);
+ 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;
@@ -776,15 +810,18 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe
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)) {
+ } 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();
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
@@ -827,7 +864,8 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe
* @generated
*/
protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
}
/**
@@ -837,6 +875,7 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe
public void deactivate() {
removeOwnerElementListeners();
super.deactivate();
+
}
/**
@@ -844,5 +883,6 @@ public class ModelNameEditPart extends PapyrusCompartmentEditPart implements ITe
*/
protected void removeOwnerElementListeners() {
removeListenerFilter(ADD_PARENT_MODEL);
+
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelNameEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelNameEditPartCN.java
index a42b08921d0..b87788e4a38 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelNameEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelNameEditPartCN.java
@@ -199,7 +199,8 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -262,7 +263,9 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
@@ -294,7 +297,9 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -317,18 +322,21 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I
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));
- }
- });
+ 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;
}
@@ -370,7 +378,9 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I
*/
protected DirectEditManager getManager() {
if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -420,7 +430,9 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I
*/
@Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
+
if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
@@ -432,7 +444,9 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I
updateExtendedEditorConfiguration();
if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
performDefaultDirectEditorEdit(theRequest);
} else {
configuration.preEditAction(resolveSemanticElement());
@@ -445,14 +459,17 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I
IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ }
+ 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);
+ 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") {
@@ -460,6 +477,7 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I
@Override
protected void doExecute() {
configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -481,14 +499,15 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I
// 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) {
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -525,7 +544,8 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I
if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
@@ -544,14 +564,17 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I
* @generated
*/
protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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 {
+ }
+ else {
((WrappingLabel) getFigure()).setTextUnderline(false);
}
}
@@ -561,7 +584,9 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ FontStyle style =
+ (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
@@ -572,9 +597,14 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I
*/
@Override
protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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));
+ FontData fontData = new FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
+ (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
@@ -655,6 +685,7 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I
if (checkDefaultEdition()) {
return IDirectEdition.DEFAULT_DIRECT_EDITOR;
}
+
// not a named element. no specific editor => do nothing
return IDirectEdition.NO_DIRECT_EDITION;
}
@@ -704,9 +735,11 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I
* @generated
*/
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ 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());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
+ .eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
@@ -728,7 +761,8 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I
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);
+ 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;
@@ -776,15 +810,18 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I
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)) {
+ } 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();
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
@@ -827,7 +864,8 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I
* @generated
*/
protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
}
/**
@@ -837,6 +875,7 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I
public void deactivate() {
removeOwnerElementListeners();
super.deactivate();
+
}
/**
@@ -844,5 +883,6 @@ public class ModelNameEditPartCN extends PapyrusCompartmentEditPart implements I
*/
protected void removeOwnerElementListeners() {
removeListenerFilter(ADD_PARENT_MODEL);
+
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelPackageableElementCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelPackageableElementCompartmentEditPart.java
index 37d9cf4bce5..8a3ca74e357 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelPackageableElementCompartmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelPackageableElementCompartmentEditPart.java
@@ -67,8 +67,9 @@ public class ModelPackageableElementCompartmentEditPart extends ShapeCompartment
installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.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.component.edit.policies.ModelPackageableElementCompartmentCanonicalEditPolicy());
+
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
}
@@ -88,6 +89,7 @@ public class ModelPackageableElementCompartmentEditPart extends ShapeCompartment
*/
@Override
public EditPart getTargetEditPart(Request request) {
+
return super.getTargetEditPart(request);
}
@@ -97,7 +99,10 @@ public class ModelPackageableElementCompartmentEditPart extends ShapeCompartment
@Override
protected void handleNotificationEvent(Notification notification) {
Object feature = notification.getFeature();
- if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ if (NotationPackage.eINSTANCE.getSize_Width().equals(feature)
+ || NotationPackage.eINSTANCE.getSize_Height().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_X().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
refreshBounds();
}
super.handleNotificationEvent(notification);
@@ -113,7 +118,10 @@ public class ModelPackageableElementCompartmentEditPart extends ShapeCompartment
int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
Point loc = new Point(x, y);
- ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(
+ this,
+ getFigure(),
+ new Rectangle(loc, size));
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelPackageableElementCompartmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelPackageableElementCompartmentEditPartCN.java
index 28884b3dbba..4170fc590c0 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelPackageableElementCompartmentEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ModelPackageableElementCompartmentEditPartCN.java
@@ -67,8 +67,9 @@ public class ModelPackageableElementCompartmentEditPartCN extends ShapeCompartme
installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.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.component.edit.policies.ModelPackageableElementCompartmentCanonicalEditPolicyCN());
+
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
}
@@ -88,6 +89,7 @@ public class ModelPackageableElementCompartmentEditPartCN extends ShapeCompartme
*/
@Override
public EditPart getTargetEditPart(Request request) {
+
return super.getTargetEditPart(request);
}
@@ -97,7 +99,10 @@ public class ModelPackageableElementCompartmentEditPartCN extends ShapeCompartme
@Override
protected void handleNotificationEvent(Notification notification) {
Object feature = notification.getFeature();
- if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ if (NotationPackage.eINSTANCE.getSize_Width().equals(feature)
+ || NotationPackage.eINSTANCE.getSize_Height().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_X().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
refreshBounds();
}
super.handleNotificationEvent(notification);
@@ -113,7 +118,10 @@ public class ModelPackageableElementCompartmentEditPartCN extends ShapeCompartme
int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
Point loc = new Point(x, y);
- ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(
+ this,
+ getFigure(),
+ new Rectangle(loc, size));
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/MultiDependencyLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/MultiDependencyLabelEditPart.java
index 2d75dbf7e09..6eaa745ca45 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/MultiDependencyLabelEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/MultiDependencyLabelEditPart.java
@@ -34,7 +34,6 @@ import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
@@ -60,6 +59,7 @@ import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
@@ -82,7 +82,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class MultiDependencyLabelEditPart extends LabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
+public class MultiDependencyLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
/**
* @generated
@@ -226,7 +226,8 @@ public class MultiDependencyLabelEditPart extends LabelEditPart implements IText
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -278,7 +279,9 @@ public class MultiDependencyLabelEditPart extends LabelEditPart implements IText
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
@@ -310,7 +313,9 @@ public class MultiDependencyLabelEditPart extends LabelEditPart implements IText
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -333,18 +338,21 @@ public class MultiDependencyLabelEditPart extends LabelEditPart implements IText
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));
- }
- });
+ 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;
}
@@ -386,7 +394,9 @@ public class MultiDependencyLabelEditPart extends LabelEditPart implements IText
*/
protected DirectEditManager getManager() {
if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -436,7 +446,9 @@ public class MultiDependencyLabelEditPart extends LabelEditPart implements IText
*/
@Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
+
if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
@@ -448,7 +460,9 @@ public class MultiDependencyLabelEditPart extends LabelEditPart implements IText
updateExtendedEditorConfiguration();
if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
performDefaultDirectEditorEdit(theRequest);
} else {
configuration.preEditAction(resolveSemanticElement());
@@ -461,14 +475,17 @@ public class MultiDependencyLabelEditPart extends LabelEditPart implements IText
IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ }
+ 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);
+ 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") {
@@ -476,6 +493,7 @@ public class MultiDependencyLabelEditPart extends LabelEditPart implements IText
@Override
protected void doExecute() {
configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -497,14 +515,15 @@ public class MultiDependencyLabelEditPart extends LabelEditPart implements IText
// 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) {
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -541,7 +560,8 @@ public class MultiDependencyLabelEditPart extends LabelEditPart implements IText
if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
@@ -560,14 +580,17 @@ public class MultiDependencyLabelEditPart extends LabelEditPart implements IText
* @generated
*/
protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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 {
+ }
+ else {
((WrappingLabel) getFigure()).setTextUnderline(false);
}
}
@@ -577,7 +600,9 @@ public class MultiDependencyLabelEditPart extends LabelEditPart implements IText
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ FontStyle style =
+ (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
@@ -588,9 +613,14 @@ public class MultiDependencyLabelEditPart extends LabelEditPart implements IText
*/
@Override
protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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));
+ FontData fontData = new FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
+ (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
@@ -671,6 +701,7 @@ public class MultiDependencyLabelEditPart extends LabelEditPart implements IText
if (checkDefaultEdition()) {
return IDirectEdition.DEFAULT_DIRECT_EDITOR;
}
+
// not a named element. no specific editor => do nothing
return IDirectEdition.NO_DIRECT_EDITION;
}
@@ -720,9 +751,11 @@ public class MultiDependencyLabelEditPart extends LabelEditPart implements IText
* @generated
*/
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ 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());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
+ .eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
@@ -744,7 +777,8 @@ public class MultiDependencyLabelEditPart extends LabelEditPart implements IText
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);
+ 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;
@@ -773,15 +807,18 @@ public class MultiDependencyLabelEditPart extends LabelEditPart implements IText
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)) {
+ } 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();
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/OperationForInterfaceEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/OperationForInterfaceEditPart.java
index 6fdf062bc76..78b1762b169 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/OperationForInterfaceEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/OperationForInterfaceEditPart.java
@@ -220,7 +220,8 @@ public class OperationForInterfaceEditPart extends UMLCompartmentEditPart implem
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -273,7 +274,9 @@ public class OperationForInterfaceEditPart extends UMLCompartmentEditPart implem
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
@@ -305,7 +308,9 @@ public class OperationForInterfaceEditPart extends UMLCompartmentEditPart implem
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -328,18 +333,21 @@ public class OperationForInterfaceEditPart extends UMLCompartmentEditPart implem
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));
- }
- });
+ 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;
}
@@ -381,7 +389,9 @@ public class OperationForInterfaceEditPart extends UMLCompartmentEditPart implem
*/
protected DirectEditManager getManager() {
if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -431,7 +441,9 @@ public class OperationForInterfaceEditPart extends UMLCompartmentEditPart implem
*/
@Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
+
if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
@@ -443,7 +455,9 @@ public class OperationForInterfaceEditPart extends UMLCompartmentEditPart implem
updateExtendedEditorConfiguration();
if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
performDefaultDirectEditorEdit(theRequest);
} else {
configuration.preEditAction(resolveSemanticElement());
@@ -456,14 +470,17 @@ public class OperationForInterfaceEditPart extends UMLCompartmentEditPart implem
IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ }
+ 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);
+ 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") {
@@ -471,6 +488,7 @@ public class OperationForInterfaceEditPart extends UMLCompartmentEditPart implem
@Override
protected void doExecute() {
configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -492,14 +510,15 @@ public class OperationForInterfaceEditPart extends UMLCompartmentEditPart implem
// 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) {
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -536,7 +555,8 @@ public class OperationForInterfaceEditPart extends UMLCompartmentEditPart implem
if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
@@ -555,14 +575,17 @@ public class OperationForInterfaceEditPart extends UMLCompartmentEditPart implem
* @generated
*/
protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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 {
+ }
+ else {
((WrappingLabel) getFigure()).setTextUnderline(false);
}
}
@@ -572,7 +595,9 @@ public class OperationForInterfaceEditPart extends UMLCompartmentEditPart implem
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ FontStyle style =
+ (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
@@ -583,9 +608,14 @@ public class OperationForInterfaceEditPart extends UMLCompartmentEditPart implem
*/
@Override
protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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));
+ FontData fontData = new FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
+ (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
@@ -666,6 +696,7 @@ public class OperationForInterfaceEditPart extends UMLCompartmentEditPart implem
if (checkDefaultEdition()) {
return IDirectEdition.DEFAULT_DIRECT_EDITOR;
}
+
// not a named element. no specific editor => do nothing
return IDirectEdition.NO_DIRECT_EDITION;
}
@@ -715,9 +746,11 @@ public class OperationForInterfaceEditPart extends UMLCompartmentEditPart implem
* @generated
*/
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ 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());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
+ .eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
@@ -739,7 +772,8 @@ public class OperationForInterfaceEditPart extends UMLCompartmentEditPart implem
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);
+ 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;
@@ -786,15 +820,18 @@ public class OperationForInterfaceEditPart extends UMLCompartmentEditPart implem
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)) {
+ } 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();
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackageEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackageEditPart.java
index 9952009cfd9..deb03b6d437 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackageEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackageEditPart.java
@@ -120,6 +120,7 @@ public class PackageEditPart extends NamedElementEditPart {
@Override
protected void handleNotificationEvent(Notification event) {
super.handleNotificationEvent(event);
+
}
/**
@@ -148,12 +149,15 @@ public class PackageEditPart extends NamedElementEditPart {
((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;
}
@@ -225,6 +229,7 @@ public class PackageEditPart extends NamedElementEditPart {
@Override
protected NodeFigure createNodeFigure() {
return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackageEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackageEditPartCN.java
index 0aec0f3236f..720ce0546ff 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackageEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackageEditPartCN.java
@@ -137,12 +137,15 @@ public class PackageEditPartCN extends NodeEditPart {
((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;
}
@@ -214,6 +217,7 @@ public class PackageEditPartCN extends NodeEditPart {
@Override
protected NodeFigure createNodeFigure() {
return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackageNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackageNameEditPart.java
index 5c18e0c5e0c..c966b26b5bf 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackageNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackageNameEditPart.java
@@ -199,7 +199,8 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -262,7 +263,9 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
@@ -294,7 +297,9 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -317,18 +322,21 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I
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));
- }
- });
+ 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;
}
@@ -370,7 +378,9 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I
*/
protected DirectEditManager getManager() {
if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -420,7 +430,9 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I
*/
@Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
+
if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
@@ -432,7 +444,9 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I
updateExtendedEditorConfiguration();
if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
performDefaultDirectEditorEdit(theRequest);
} else {
configuration.preEditAction(resolveSemanticElement());
@@ -445,14 +459,17 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I
IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ }
+ 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);
+ 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") {
@@ -460,6 +477,7 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I
@Override
protected void doExecute() {
configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -481,14 +499,15 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I
// 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) {
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -525,7 +544,8 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I
if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
@@ -544,14 +564,17 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I
* @generated
*/
protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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 {
+ }
+ else {
((WrappingLabel) getFigure()).setTextUnderline(false);
}
}
@@ -561,7 +584,9 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ FontStyle style =
+ (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
@@ -572,9 +597,14 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I
*/
@Override
protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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));
+ FontData fontData = new FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
+ (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
@@ -655,6 +685,7 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I
if (checkDefaultEdition()) {
return IDirectEdition.DEFAULT_DIRECT_EDITOR;
}
+
// not a named element. no specific editor => do nothing
return IDirectEdition.NO_DIRECT_EDITION;
}
@@ -704,9 +735,11 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I
* @generated
*/
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ 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());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
+ .eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
@@ -728,7 +761,8 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I
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);
+ 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;
@@ -776,15 +810,18 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I
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)) {
+ } 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();
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
@@ -827,7 +864,8 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I
* @generated
*/
protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
}
/**
@@ -837,6 +875,7 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I
public void deactivate() {
removeOwnerElementListeners();
super.deactivate();
+
}
/**
@@ -844,5 +883,6 @@ public class PackageNameEditPart extends PapyrusCompartmentEditPart implements I
*/
protected void removeOwnerElementListeners() {
removeListenerFilter(ADD_PARENT_MODEL);
+
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackageNameEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackageNameEditPartCN.java
index 1361a0d13f6..3e66afbc23c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackageNameEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackageNameEditPartCN.java
@@ -199,7 +199,8 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -262,7 +263,9 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
@@ -294,7 +297,9 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -317,18 +322,21 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements
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));
- }
- });
+ 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;
}
@@ -370,7 +378,9 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements
*/
protected DirectEditManager getManager() {
if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -420,7 +430,9 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements
*/
@Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
+
if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
@@ -432,7 +444,9 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements
updateExtendedEditorConfiguration();
if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
performDefaultDirectEditorEdit(theRequest);
} else {
configuration.preEditAction(resolveSemanticElement());
@@ -445,14 +459,17 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements
IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ }
+ 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);
+ 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") {
@@ -460,6 +477,7 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements
@Override
protected void doExecute() {
configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -481,14 +499,15 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements
// 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) {
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -525,7 +544,8 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements
if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
@@ -544,14 +564,17 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements
* @generated
*/
protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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 {
+ }
+ else {
((WrappingLabel) getFigure()).setTextUnderline(false);
}
}
@@ -561,7 +584,9 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ FontStyle style =
+ (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
@@ -572,9 +597,14 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements
*/
@Override
protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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));
+ FontData fontData = new FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
+ (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
@@ -655,6 +685,7 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements
if (checkDefaultEdition()) {
return IDirectEdition.DEFAULT_DIRECT_EDITOR;
}
+
// not a named element. no specific editor => do nothing
return IDirectEdition.NO_DIRECT_EDITION;
}
@@ -704,9 +735,11 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements
* @generated
*/
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ 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());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
+ .eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
@@ -728,7 +761,8 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements
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);
+ 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;
@@ -776,15 +810,18 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements
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)) {
+ } 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();
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
@@ -827,7 +864,8 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements
* @generated
*/
protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
}
/**
@@ -837,6 +875,7 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements
public void deactivate() {
removeOwnerElementListeners();
super.deactivate();
+
}
/**
@@ -844,5 +883,6 @@ public class PackageNameEditPartCN extends PapyrusCompartmentEditPart implements
*/
protected void removeOwnerElementListeners() {
removeListenerFilter(ADD_PARENT_MODEL);
+
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackagePackageableElementCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackagePackageableElementCompartmentEditPart.java
index 35ae23e08b8..f30b35a54b8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackagePackageableElementCompartmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackagePackageableElementCompartmentEditPart.java
@@ -67,8 +67,9 @@ public class PackagePackageableElementCompartmentEditPart extends ShapeCompartme
installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.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.component.edit.policies.PackagePackageableElementCompartmentCanonicalEditPolicy());
+
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
}
@@ -88,6 +89,7 @@ public class PackagePackageableElementCompartmentEditPart extends ShapeCompartme
*/
@Override
public EditPart getTargetEditPart(Request request) {
+
return super.getTargetEditPart(request);
}
@@ -97,7 +99,10 @@ public class PackagePackageableElementCompartmentEditPart extends ShapeCompartme
@Override
protected void handleNotificationEvent(Notification notification) {
Object feature = notification.getFeature();
- if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ if (NotationPackage.eINSTANCE.getSize_Width().equals(feature)
+ || NotationPackage.eINSTANCE.getSize_Height().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_X().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
refreshBounds();
}
super.handleNotificationEvent(notification);
@@ -113,7 +118,10 @@ public class PackagePackageableElementCompartmentEditPart extends ShapeCompartme
int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
Point loc = new Point(x, y);
- ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(
+ this,
+ getFigure(),
+ new Rectangle(loc, size));
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackagePackageableElementCompartmentEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackagePackageableElementCompartmentEditPartCN.java
index 0ac7007cfa9..47c6725337c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackagePackageableElementCompartmentEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PackagePackageableElementCompartmentEditPartCN.java
@@ -67,8 +67,9 @@ public class PackagePackageableElementCompartmentEditPartCN extends ShapeCompart
installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.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.component.edit.policies.PackagePackageableElementCompartmentCanonicalEditPolicyCN());
+
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
}
@@ -88,6 +89,7 @@ public class PackagePackageableElementCompartmentEditPartCN extends ShapeCompart
*/
@Override
public EditPart getTargetEditPart(Request request) {
+
return super.getTargetEditPart(request);
}
@@ -97,7 +99,10 @@ public class PackagePackageableElementCompartmentEditPartCN extends ShapeCompart
@Override
protected void handleNotificationEvent(Notification notification) {
Object feature = notification.getFeature();
- if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ if (NotationPackage.eINSTANCE.getSize_Width().equals(feature)
+ || NotationPackage.eINSTANCE.getSize_Height().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_X().equals(feature)
+ || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
refreshBounds();
}
super.handleNotificationEvent(notification);
@@ -113,7 +118,10 @@ public class PackagePackageableElementCompartmentEditPartCN extends ShapeCompart
int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
Point loc = new Point(x, y);
- ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(
+ this,
+ getFigure(),
+ new Rectangle(loc, size));
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PortAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PortAppliedStereotypeEditPart.java
index 93d5b6605a8..43ba4f16f28 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PortAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PortAppliedStereotypeEditPart.java
@@ -34,7 +34,6 @@ import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
@@ -60,6 +59,7 @@ import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
@@ -86,7 +86,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PortAppliedStereotypeEditPart extends LabelEditPart implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider {
+public class PortAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider {
/**
* @generated
@@ -231,7 +231,8 @@ public class PortAppliedStereotypeEditPart extends LabelEditPart implements ITex
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -283,7 +284,9 @@ public class PortAppliedStereotypeEditPart extends LabelEditPart implements ITex
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
@@ -315,7 +318,9 @@ public class PortAppliedStereotypeEditPart extends LabelEditPart implements ITex
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -338,18 +343,21 @@ public class PortAppliedStereotypeEditPart extends LabelEditPart implements ITex
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));
- }
- });
+ 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;
}
@@ -391,7 +399,9 @@ public class PortAppliedStereotypeEditPart extends LabelEditPart implements ITex
*/
protected DirectEditManager getManager() {
if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -441,7 +451,9 @@ public class PortAppliedStereotypeEditPart extends LabelEditPart implements ITex
*/
@Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
+
if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
@@ -453,7 +465,9 @@ public class PortAppliedStereotypeEditPart extends LabelEditPart implements ITex
updateExtendedEditorConfiguration();
if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
performDefaultDirectEditorEdit(theRequest);
} else {
configuration.preEditAction(resolveSemanticElement());
@@ -466,14 +480,17 @@ public class PortAppliedStereotypeEditPart extends LabelEditPart implements ITex
IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ }
+ 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);
+ 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") {
@@ -481,6 +498,7 @@ public class PortAppliedStereotypeEditPart extends LabelEditPart implements ITex
@Override
protected void doExecute() {
configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -502,14 +520,15 @@ public class PortAppliedStereotypeEditPart extends LabelEditPart implements ITex
// 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) {
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -546,7 +565,8 @@ public class PortAppliedStereotypeEditPart extends LabelEditPart implements ITex
if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
@@ -565,14 +585,17 @@ public class PortAppliedStereotypeEditPart extends LabelEditPart implements ITex
* @generated
*/
protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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 {
+ }
+ else {
((WrappingLabel) getFigure()).setTextUnderline(false);
}
}
@@ -582,7 +605,9 @@ public class PortAppliedStereotypeEditPart extends LabelEditPart implements ITex
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ FontStyle style =
+ (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
@@ -593,9 +618,14 @@ public class PortAppliedStereotypeEditPart extends LabelEditPart implements ITex
*/
@Override
protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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));
+ FontData fontData = new FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
+ (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
@@ -718,9 +748,11 @@ public class PortAppliedStereotypeEditPart extends LabelEditPart implements ITex
* @generated
*/
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ 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());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
+ .eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
@@ -742,7 +774,8 @@ public class PortAppliedStereotypeEditPart extends LabelEditPart implements ITex
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);
+ 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;
@@ -771,15 +804,18 @@ public class PortAppliedStereotypeEditPart extends LabelEditPart implements ITex
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)) {
+ } 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();
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PortEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PortEditPart.java
index 47fc6ec0fc5..ccec1192bd7 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PortEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PortEditPart.java
@@ -122,7 +122,8 @@ public class PortEditPart extends AbstractBorderEditPart {
mh.setBorder(null);
return Collections.singletonList(mh);
}
- };
+ }
+ ;
}
EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
if (result == null) {
@@ -165,6 +166,7 @@ public class PortEditPart extends AbstractBorderEditPart {
}
}
super.handleNotificationEvent(event);
+
}
/**
@@ -196,7 +198,8 @@ public class PortEditPart extends AbstractBorderEditPart {
} else if (borderItemEditPart instanceof PortNameEditPart) {
IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else {
+ } else
+ {
super.addBorderItem(borderItemContainer, borderItemEditPart);
}
}
@@ -225,6 +228,7 @@ public class PortEditPart extends AbstractBorderEditPart {
figure.add(shape);
contentPane = setupContentPane(shape);
return figure;
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PortNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PortNameEditPart.java
index 6faa3e9672c..07b92cd1bfe 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PortNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PortNameEditPart.java
@@ -34,7 +34,6 @@ import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
@@ -60,9 +59,11 @@ import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.LabelAlignmentEditPolicy;
+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.ILabelRoleProvider;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
@@ -85,7 +86,7 @@ import org.eclipse.uml2.uml.Feature;
/**
* @generated
*/
-public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider {
+public class PortNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider {
/**
* @generated
@@ -231,7 +232,8 @@ public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPar
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -283,7 +285,9 @@ public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPar
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
@@ -315,7 +319,9 @@ public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPar
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -338,18 +344,21 @@ public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPar
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));
- }
- });
+ 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;
}
@@ -391,7 +400,9 @@ public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPar
*/
protected DirectEditManager getManager() {
if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -441,7 +452,9 @@ public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPar
*/
@Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
+
if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
@@ -453,7 +466,9 @@ public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPar
updateExtendedEditorConfiguration();
if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
performDefaultDirectEditorEdit(theRequest);
} else {
configuration.preEditAction(resolveSemanticElement());
@@ -466,14 +481,17 @@ public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPar
IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ }
+ 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);
+ 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") {
@@ -481,6 +499,7 @@ public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPar
@Override
protected void doExecute() {
configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -502,14 +521,15 @@ public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPar
// 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) {
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -546,7 +566,8 @@ public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPar
if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
@@ -565,14 +586,17 @@ public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPar
* @generated
*/
protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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 {
+ }
+ else {
((WrappingLabel) getFigure()).setTextUnderline(false);
}
}
@@ -582,7 +606,9 @@ public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPar
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ FontStyle style =
+ (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
@@ -593,9 +619,14 @@ public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPar
*/
@Override
protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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));
+ FontData fontData = new FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
+ (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
@@ -676,6 +707,7 @@ public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPar
if (checkDefaultEdition()) {
return IDirectEdition.DEFAULT_DIRECT_EDITOR;
}
+
// not a named element. no specific editor => do nothing
return IDirectEdition.NO_DIRECT_EDITION;
}
@@ -725,9 +757,11 @@ public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPar
* @generated
*/
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ 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());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
+ .eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
@@ -749,7 +783,8 @@ public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPar
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);
+ 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;
@@ -778,15 +813,18 @@ public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPar
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)) {
+ } 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();
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
@@ -813,7 +851,7 @@ public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPar
* @generated
*/
protected IFigure createFigurePrim() {
- return new WrappingLabel();
+ return new PapyrusWrappingLabel();
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PropertyForInterfaceEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PropertyForInterfaceEditPart.java
index 4264260044c..f04dd93ffc4 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PropertyForInterfaceEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PropertyForInterfaceEditPart.java
@@ -220,7 +220,8 @@ public class PropertyForInterfaceEditPart extends UMLCompartmentEditPart impleme
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -273,7 +274,9 @@ public class PropertyForInterfaceEditPart extends UMLCompartmentEditPart impleme
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
@@ -305,7 +308,9 @@ public class PropertyForInterfaceEditPart extends UMLCompartmentEditPart impleme
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -328,18 +333,21 @@ public class PropertyForInterfaceEditPart extends UMLCompartmentEditPart impleme
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));
- }
- });
+ 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;
}
@@ -381,7 +389,9 @@ public class PropertyForInterfaceEditPart extends UMLCompartmentEditPart impleme
*/
protected DirectEditManager getManager() {
if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -431,7 +441,9 @@ public class PropertyForInterfaceEditPart extends UMLCompartmentEditPart impleme
*/
@Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
+
if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
@@ -443,7 +455,9 @@ public class PropertyForInterfaceEditPart extends UMLCompartmentEditPart impleme
updateExtendedEditorConfiguration();
if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
performDefaultDirectEditorEdit(theRequest);
} else {
configuration.preEditAction(resolveSemanticElement());
@@ -456,14 +470,17 @@ public class PropertyForInterfaceEditPart extends UMLCompartmentEditPart impleme
IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ }
+ 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);
+ 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") {
@@ -471,6 +488,7 @@ public class PropertyForInterfaceEditPart extends UMLCompartmentEditPart impleme
@Override
protected void doExecute() {
configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -492,14 +510,15 @@ public class PropertyForInterfaceEditPart extends UMLCompartmentEditPart impleme
// 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) {
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -536,7 +555,8 @@ public class PropertyForInterfaceEditPart extends UMLCompartmentEditPart impleme
if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
@@ -555,14 +575,17 @@ public class PropertyForInterfaceEditPart extends UMLCompartmentEditPart impleme
* @generated
*/
protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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 {
+ }
+ else {
((WrappingLabel) getFigure()).setTextUnderline(false);
}
}
@@ -572,7 +595,9 @@ public class PropertyForInterfaceEditPart extends UMLCompartmentEditPart impleme
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ FontStyle style =
+ (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
@@ -583,9 +608,14 @@ public class PropertyForInterfaceEditPart extends UMLCompartmentEditPart impleme
*/
@Override
protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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));
+ FontData fontData = new FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
+ (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
@@ -666,6 +696,7 @@ public class PropertyForInterfaceEditPart extends UMLCompartmentEditPart impleme
if (checkDefaultEdition()) {
return IDirectEdition.DEFAULT_DIRECT_EDITOR;
}
+
// not a named element. no specific editor => do nothing
return IDirectEdition.NO_DIRECT_EDITION;
}
@@ -715,9 +746,11 @@ public class PropertyForInterfaceEditPart extends UMLCompartmentEditPart impleme
* @generated
*/
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ 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());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
+ .eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
@@ -739,7 +772,8 @@ public class PropertyForInterfaceEditPart extends UMLCompartmentEditPart impleme
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);
+ 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;
@@ -786,15 +820,18 @@ public class PropertyForInterfaceEditPart extends UMLCompartmentEditPart impleme
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)) {
+ } 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();
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PropertyPartEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PropertyPartEditPartCN.java
index 6d9b626f9f7..2cd3ffc9579 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PropertyPartEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PropertyPartEditPartCN.java
@@ -87,8 +87,9 @@ public class PropertyPartEditPartCN extends CustomPropertyPartEditPartCN {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PropertyItemSemanticEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
- // in Papyrus diagrams are not strongly synchronised
- // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.edit.policies.PropertyCanonicalEditPolicy());
+ //in Papyrus diagrams are not strongly synchronised
+ //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.component.edit.policies.PropertyCanonicalEditPolicy());
+
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PropertyPartItemSemanticEditPolicyCN());
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
@@ -143,6 +144,7 @@ public class PropertyPartEditPartCN extends CustomPropertyPartEditPartCN {
@Override
protected void handleNotificationEvent(Notification event) {
super.handleNotificationEvent(event);
+
}
/**
@@ -171,12 +173,18 @@ public class PropertyPartEditPartCN extends CustomPropertyPartEditPartCN {
((PropertyPartNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
return true;
}
- // Papyrus Gencode :Affixed Port locator
+
+
+
+
+ //Papyrus Gencode :Affixed Port locator
if (childEditPart instanceof PortEditPart) {
IBorderItemLocator locator = new PortPositionLocator(getMainFigure(), PositionConstants.NONE);
getBorderedFigure().getBorderItemContainer().add(((PortEditPart) childEditPart).getFigure(), locator);
return true;
}
+
+
return false;
}
@@ -247,6 +255,7 @@ public class PropertyPartEditPartCN extends CustomPropertyPartEditPartCN {
@Override
protected NodeFigure createMainFigure() {
return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PropertyPartNameEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PropertyPartNameEditPartCN.java
index 6070c177197..abe999ff9e4 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PropertyPartNameEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PropertyPartNameEditPartCN.java
@@ -201,7 +201,8 @@ public class PropertyPartNameEditPartCN extends PapyrusCompartmentEditPart imple
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -264,7 +265,9 @@ public class PropertyPartNameEditPartCN extends PapyrusCompartmentEditPart imple
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
@@ -296,7 +299,9 @@ public class PropertyPartNameEditPartCN extends PapyrusCompartmentEditPart imple
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -319,18 +324,21 @@ public class PropertyPartNameEditPartCN extends PapyrusCompartmentEditPart imple
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));
- }
- });
+ 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;
}
@@ -372,7 +380,9 @@ public class PropertyPartNameEditPartCN extends PapyrusCompartmentEditPart imple
*/
protected DirectEditManager getManager() {
if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -422,7 +432,9 @@ public class PropertyPartNameEditPartCN extends PapyrusCompartmentEditPart imple
*/
@Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
+
if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
@@ -434,7 +446,9 @@ public class PropertyPartNameEditPartCN extends PapyrusCompartmentEditPart imple
updateExtendedEditorConfiguration();
if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
performDefaultDirectEditorEdit(theRequest);
} else {
configuration.preEditAction(resolveSemanticElement());
@@ -447,14 +461,17 @@ public class PropertyPartNameEditPartCN extends PapyrusCompartmentEditPart imple
IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ }
+ 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);
+ 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") {
@@ -462,6 +479,7 @@ public class PropertyPartNameEditPartCN extends PapyrusCompartmentEditPart imple
@Override
protected void doExecute() {
configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -483,14 +501,15 @@ public class PropertyPartNameEditPartCN extends PapyrusCompartmentEditPart imple
// 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) {
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -527,7 +546,8 @@ public class PropertyPartNameEditPartCN extends PapyrusCompartmentEditPart imple
if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
@@ -546,14 +566,17 @@ public class PropertyPartNameEditPartCN extends PapyrusCompartmentEditPart imple
* @generated
*/
protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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 {
+ }
+ else {
((WrappingLabel) getFigure()).setTextUnderline(false);
}
}
@@ -563,7 +586,9 @@ public class PropertyPartNameEditPartCN extends PapyrusCompartmentEditPart imple
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ FontStyle style =
+ (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
@@ -574,9 +599,14 @@ public class PropertyPartNameEditPartCN extends PapyrusCompartmentEditPart imple
*/
@Override
protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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));
+ FontData fontData = new FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
+ (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
@@ -657,6 +687,7 @@ public class PropertyPartNameEditPartCN extends PapyrusCompartmentEditPart imple
if (checkDefaultEdition()) {
return IDirectEdition.DEFAULT_DIRECT_EDITOR;
}
+
// not a named element. no specific editor => do nothing
return IDirectEdition.NO_DIRECT_EDITION;
}
@@ -706,9 +737,11 @@ public class PropertyPartNameEditPartCN extends PapyrusCompartmentEditPart imple
* @generated
*/
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ 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());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
+ .eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
@@ -730,7 +763,8 @@ public class PropertyPartNameEditPartCN extends PapyrusCompartmentEditPart imple
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);
+ 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;
@@ -778,15 +812,18 @@ public class PropertyPartNameEditPartCN extends PapyrusCompartmentEditPart imple
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)) {
+ } 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();
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
@@ -829,7 +866,8 @@ public class PropertyPartNameEditPartCN extends PapyrusCompartmentEditPart imple
* @generated
*/
protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
}
/**
@@ -839,6 +877,7 @@ public class PropertyPartNameEditPartCN extends PapyrusCompartmentEditPart imple
public void deactivate() {
removeOwnerElementListeners();
super.deactivate();
+
}
/**
@@ -846,5 +885,6 @@ public class PropertyPartNameEditPartCN extends PapyrusCompartmentEditPart imple
*/
protected void removeOwnerElementListeners() {
removeListenerFilter(ADD_PARENT_MODEL);
+
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ReceptionInInterfaceEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ReceptionInInterfaceEditPart.java
index 1096aa7139b..d9b26e869e9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ReceptionInInterfaceEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/ReceptionInInterfaceEditPart.java
@@ -215,7 +215,8 @@ public class ReceptionInInterfaceEditPart extends CompartmentEditPart implements
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -268,7 +269,9 @@ public class ReceptionInInterfaceEditPart extends CompartmentEditPart implements
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
@@ -300,7 +303,9 @@ public class ReceptionInInterfaceEditPart extends CompartmentEditPart implements
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -323,18 +328,21 @@ public class ReceptionInInterfaceEditPart extends CompartmentEditPart implements
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));
- }
- });
+ 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;
}
@@ -376,7 +384,9 @@ public class ReceptionInInterfaceEditPart extends CompartmentEditPart implements
*/
protected DirectEditManager getManager() {
if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -426,7 +436,9 @@ public class ReceptionInInterfaceEditPart extends CompartmentEditPart implements
*/
@Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
+
if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
@@ -438,7 +450,9 @@ public class ReceptionInInterfaceEditPart extends CompartmentEditPart implements
updateExtendedEditorConfiguration();
if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
performDefaultDirectEditorEdit(theRequest);
} else {
configuration.preEditAction(resolveSemanticElement());
@@ -451,14 +465,17 @@ public class ReceptionInInterfaceEditPart extends CompartmentEditPart implements
IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ }
+ 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);
+ 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") {
@@ -466,6 +483,7 @@ public class ReceptionInInterfaceEditPart extends CompartmentEditPart implements
@Override
protected void doExecute() {
configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -487,14 +505,15 @@ public class ReceptionInInterfaceEditPart extends CompartmentEditPart implements
// 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) {
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -531,7 +550,8 @@ public class ReceptionInInterfaceEditPart extends CompartmentEditPart implements
if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
@@ -550,14 +570,17 @@ public class ReceptionInInterfaceEditPart extends CompartmentEditPart implements
* @generated
*/
protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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 {
+ }
+ else {
((WrappingLabel) getFigure()).setTextUnderline(false);
}
}
@@ -567,7 +590,9 @@ public class ReceptionInInterfaceEditPart extends CompartmentEditPart implements
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ FontStyle style =
+ (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
@@ -578,9 +603,14 @@ public class ReceptionInInterfaceEditPart extends CompartmentEditPart implements
*/
@Override
protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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));
+ FontData fontData = new FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
+ (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
@@ -661,6 +691,7 @@ public class ReceptionInInterfaceEditPart extends CompartmentEditPart implements
if (checkDefaultEdition()) {
return IDirectEdition.DEFAULT_DIRECT_EDITOR;
}
+
// not a named element. no specific editor => do nothing
return IDirectEdition.NO_DIRECT_EDITION;
}
@@ -710,9 +741,11 @@ public class ReceptionInInterfaceEditPart extends CompartmentEditPart implements
* @generated
*/
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ 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());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
+ .eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
@@ -734,7 +767,8 @@ public class ReceptionInInterfaceEditPart extends CompartmentEditPart implements
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);
+ 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;
@@ -781,15 +815,18 @@ public class ReceptionInInterfaceEditPart extends CompartmentEditPart implements
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)) {
+ } 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();
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/RectangleInterfaceEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/RectangleInterfaceEditPart.java
index c9c9cb4afb6..313ba4c5163 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/RectangleInterfaceEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/RectangleInterfaceEditPart.java
@@ -136,18 +136,22 @@ public class RectangleInterfaceEditPart extends NodeEditPart {
((RectangleInterfaceNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
return true;
}
+
+
if (childEditPart instanceof InterfaceAttributeCompartmentEditPart) {
IFigure pane = getPrimaryShape().getAttributeCompartmentFigure();
setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
pane.add(((InterfaceAttributeCompartmentEditPart) childEditPart).getFigure());
return true;
}
+
if (childEditPart instanceof InterfaceOperationCompartmentEditPart) {
IFigure pane = getPrimaryShape().getOperationCompartmentFigure();
setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
pane.add(((InterfaceOperationCompartmentEditPart) childEditPart).getFigure());
return true;
}
+
return false;
}
@@ -227,6 +231,7 @@ public class RectangleInterfaceEditPart extends NodeEditPart {
@Override
protected NodeFigure createNodeFigure() {
return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/RectangleInterfaceEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/RectangleInterfaceEditPartCN.java
index 8ab15ac0642..64d3e648895 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/RectangleInterfaceEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/RectangleInterfaceEditPartCN.java
@@ -136,18 +136,22 @@ public class RectangleInterfaceEditPartCN extends NodeEditPart {
((RectangleInterfaceNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
return true;
}
+
+
if (childEditPart instanceof InterfaceAttributeCompartmentEditPartCN) {
IFigure pane = getPrimaryShape().getAttributeCompartmentFigure();
setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
pane.add(((InterfaceAttributeCompartmentEditPartCN) childEditPart).getFigure());
return true;
}
+
if (childEditPart instanceof InterfaceOperationCompartmentEditPartCN) {
IFigure pane = getPrimaryShape().getOperationCompartmentFigure();
setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
pane.add(((InterfaceOperationCompartmentEditPartCN) childEditPart).getFigure());
return true;
}
+
return false;
}
@@ -227,6 +231,7 @@ public class RectangleInterfaceEditPartCN extends NodeEditPart {
@Override
protected NodeFigure createNodeFigure() {
return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/RectangleInterfaceNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/RectangleInterfaceNameEditPart.java
index 40bebb64d03..075747e0daf 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/RectangleInterfaceNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/RectangleInterfaceNameEditPart.java
@@ -199,7 +199,8 @@ public class RectangleInterfaceNameEditPart extends PapyrusCompartmentEditPart i
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -262,7 +263,9 @@ public class RectangleInterfaceNameEditPart extends PapyrusCompartmentEditPart i
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
@@ -294,7 +297,9 @@ public class RectangleInterfaceNameEditPart extends PapyrusCompartmentEditPart i
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -317,18 +322,21 @@ public class RectangleInterfaceNameEditPart extends PapyrusCompartmentEditPart i
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));
- }
- });
+ 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;
}
@@ -370,7 +378,9 @@ public class RectangleInterfaceNameEditPart extends PapyrusCompartmentEditPart i
*/
protected DirectEditManager getManager() {
if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -420,7 +430,9 @@ public class RectangleInterfaceNameEditPart extends PapyrusCompartmentEditPart i
*/
@Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
+
if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
@@ -432,7 +444,9 @@ public class RectangleInterfaceNameEditPart extends PapyrusCompartmentEditPart i
updateExtendedEditorConfiguration();
if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
performDefaultDirectEditorEdit(theRequest);
} else {
configuration.preEditAction(resolveSemanticElement());
@@ -445,14 +459,17 @@ public class RectangleInterfaceNameEditPart extends PapyrusCompartmentEditPart i
IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ }
+ 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);
+ 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") {
@@ -460,6 +477,7 @@ public class RectangleInterfaceNameEditPart extends PapyrusCompartmentEditPart i
@Override
protected void doExecute() {
configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -481,14 +499,15 @@ public class RectangleInterfaceNameEditPart extends PapyrusCompartmentEditPart i
// 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) {
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -525,7 +544,8 @@ public class RectangleInterfaceNameEditPart extends PapyrusCompartmentEditPart i
if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
@@ -544,14 +564,17 @@ public class RectangleInterfaceNameEditPart extends PapyrusCompartmentEditPart i
* @generated
*/
protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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 {
+ }
+ else {
((WrappingLabel) getFigure()).setTextUnderline(false);
}
}
@@ -561,7 +584,9 @@ public class RectangleInterfaceNameEditPart extends PapyrusCompartmentEditPart i
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ FontStyle style =
+ (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
@@ -572,9 +597,14 @@ public class RectangleInterfaceNameEditPart extends PapyrusCompartmentEditPart i
*/
@Override
protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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));
+ FontData fontData = new FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
+ (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
@@ -655,6 +685,7 @@ public class RectangleInterfaceNameEditPart extends PapyrusCompartmentEditPart i
if (checkDefaultEdition()) {
return IDirectEdition.DEFAULT_DIRECT_EDITOR;
}
+
// not a named element. no specific editor => do nothing
return IDirectEdition.NO_DIRECT_EDITION;
}
@@ -704,9 +735,11 @@ public class RectangleInterfaceNameEditPart extends PapyrusCompartmentEditPart i
* @generated
*/
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ 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());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
+ .eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
@@ -728,7 +761,8 @@ public class RectangleInterfaceNameEditPart extends PapyrusCompartmentEditPart i
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);
+ 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;
@@ -776,15 +810,18 @@ public class RectangleInterfaceNameEditPart extends PapyrusCompartmentEditPart i
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)) {
+ } 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();
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
@@ -827,7 +864,8 @@ public class RectangleInterfaceNameEditPart extends PapyrusCompartmentEditPart i
* @generated
*/
protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
}
/**
@@ -837,6 +875,7 @@ public class RectangleInterfaceNameEditPart extends PapyrusCompartmentEditPart i
public void deactivate() {
removeOwnerElementListeners();
super.deactivate();
+
}
/**
@@ -844,5 +883,6 @@ public class RectangleInterfaceNameEditPart extends PapyrusCompartmentEditPart i
*/
protected void removeOwnerElementListeners() {
removeListenerFilter(ADD_PARENT_MODEL);
+
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/RectangleInterfaceNameEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/RectangleInterfaceNameEditPartCN.java
index 7acf6857120..d19ad8198dd 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/RectangleInterfaceNameEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/RectangleInterfaceNameEditPartCN.java
@@ -195,7 +195,8 @@ public class RectangleInterfaceNameEditPartCN extends PapyrusCompartmentEditPart
/**
* @generated
*/
- public void setLabel(IFigure figure) {
+ public void setLabel(IFigure
+ figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
@@ -248,7 +249,9 @@ public class RectangleInterfaceNameEditPartCN extends PapyrusCompartmentEditPart
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ text = getParser().getPrintString(
+ new EObjectAdapter(parserElement),
+ getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
@@ -280,7 +283,9 @@ public class RectangleInterfaceNameEditPartCN extends PapyrusCompartmentEditPart
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ return getParser().getEditString(
+ new EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
}
/**
@@ -303,18 +308,21 @@ public class RectangleInterfaceNameEditPartCN extends PapyrusCompartmentEditPart
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));
- }
- });
+ 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;
}
@@ -356,7 +364,9 @@ public class RectangleInterfaceNameEditPartCN extends PapyrusCompartmentEditPart
*/
protected DirectEditManager getManager() {
if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
@@ -406,7 +416,9 @@ public class RectangleInterfaceNameEditPartCN extends PapyrusCompartmentEditPart
*/
@Override
protected void performDirectEditRequest(Request request) {
+
final Request theRequest = request;
+
if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
directEditionMode = getDirectEditionType();
}
@@ -418,7 +430,9 @@ public class RectangleInterfaceNameEditPartCN extends PapyrusCompartmentEditPart
updateExtendedEditorConfiguration();
if (configuration == null || configuration.getLanguage() == null) {
// Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ setManager(new MultilineLabelDirectEditManager(this,
+ MultilineLabelDirectEditManager.getTextCellEditorClass(this),
+ UMLEditPartFactory.getTextCellEditorLocator(this)));
performDefaultDirectEditorEdit(theRequest);
} else {
configuration.preEditAction(resolveSemanticElement());
@@ -431,14 +445,17 @@ public class RectangleInterfaceNameEditPartCN extends PapyrusCompartmentEditPart
IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
helper.showEditor();
return;
- } else if (configuration instanceof IAdvancedEditorConfiguration) {
+ }
+ 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);
+ 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") {
@@ -446,6 +463,7 @@ public class RectangleInterfaceNameEditPartCN extends PapyrusCompartmentEditPart
@Override
protected void doExecute() {
configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
+
}
};
domain.getCommandStack().execute(command);
@@ -467,14 +485,15 @@ public class RectangleInterfaceNameEditPartCN extends PapyrusCompartmentEditPart
// 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) {
+ 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 {
+ }
+ else {
performDirectEdit();
}
}
@@ -511,7 +530,8 @@ public class RectangleInterfaceNameEditPartCN extends PapyrusCompartmentEditPart
if (view.isVisible()) {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
- } else {
+ }
+ else {
setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
setLabelIconHelper(getFigure(), null);
}
@@ -530,14 +550,17 @@ public class RectangleInterfaceNameEditPartCN extends PapyrusCompartmentEditPart
* @generated
*/
protected void refreshUnderline() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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 {
+ }
+ else {
((WrappingLabel) getFigure()).setTextUnderline(false);
}
}
@@ -547,7 +570,9 @@ public class RectangleInterfaceNameEditPartCN extends PapyrusCompartmentEditPart
* @generated
*/
protected void refreshStrikeThrough() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ FontStyle style =
+ (FontStyle) getFontStyleOwnerView().getStyle(
+ NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
@@ -558,9 +583,14 @@ public class RectangleInterfaceNameEditPartCN extends PapyrusCompartmentEditPart
*/
@Override
protected void refreshFont() {
- FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ 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));
+ FontData fontData = new FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
+ (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
@@ -641,6 +671,7 @@ public class RectangleInterfaceNameEditPartCN extends PapyrusCompartmentEditPart
if (checkDefaultEdition()) {
return IDirectEdition.DEFAULT_DIRECT_EDITOR;
}
+
// not a named element. no specific editor => do nothing
return IDirectEdition.NO_DIRECT_EDITION;
}
@@ -690,9 +721,11 @@ public class RectangleInterfaceNameEditPartCN extends PapyrusCompartmentEditPart
* @generated
*/
protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ 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());
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
+ .eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
}
@@ -714,7 +747,8 @@ public class RectangleInterfaceNameEditPartCN extends PapyrusCompartmentEditPart
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);
+ 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;
@@ -762,15 +796,18 @@ public class RectangleInterfaceNameEditPartCN extends PapyrusCompartmentEditPart
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)) {
+ } 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();
+ ISemanticParser modelParser =
+ (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
@@ -810,7 +847,8 @@ public class RectangleInterfaceNameEditPartCN extends PapyrusCompartmentEditPart
* @generated
*/
protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+ addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
+
}
/**
@@ -820,6 +858,7 @@ public class RectangleInterfaceNameEditPartCN extends PapyrusCompartmentEditPart
public void deactivate() {
removeOwnerElementListeners();
super.deactivate();
+
}
/**
@@ -827,5 +866,6 @@ public class RectangleInterfaceNameEditPartCN extends PapyrusCompartmentEditPart
*/
protected void removeOwnerElementListeners() {
removeListenerFilter(ADD_PARENT_MODEL);
+
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/SubstitutionAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/SubstitutionAppliedStereotypeEditPart.java
index ffaf6f9776a..53fd06c52fc 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/SubstitutionAppliedStereotypeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/SubstitutionAppliedStereotypeEditPart.java
@@ -1,789 +1,828 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.component.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.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.component.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.component.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 SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 6020;
-
- /**
- * @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.component.edit.parts.SubstitutionAppliedStereotypeEditPart.VISUAL_ID), new Point(0, 30));
- }
-
- /**
- * @generated
- */
- public SubstitutionAppliedStereotypeEditPart(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());
- }
-
- /**
- * @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
- */
- 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.Substitution_4012, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.edit.parts.SubstitutionAppliedStereotypeEditPart.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() {
- // 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.component.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.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.component.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.component.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 SubstitutionAppliedStereotypeEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6020;
+
+ /**
+ * @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.component.edit.parts.SubstitutionAppliedStereotypeEditPart.VISUAL_ID), new Point(0, 30));
+ }
+
+ /**
+ * @generated
+ */
+ public SubstitutionAppliedStereotypeEditPart(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.Substitution_4012, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.edit.parts.SubstitutionAppliedStereotypeEditPart.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() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/SubstitutionEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/SubstitutionEditPart.java
index 40ca09243eb..7378369ec35 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/SubstitutionEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/SubstitutionEditPart.java
@@ -59,10 +59,12 @@ public class SubstitutionEditPart extends UMLConnectionNodeEditPart implements I
*/
protected boolean addFixedChild(EditPart childEditPart) {
if (childEditPart instanceof SubstitutionNameEditPart) {
- ((SubstitutionNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ ((SubstitutionNameEditPart) childEditPart).setLabel(
+ getPrimaryShape().getNameLabel());
}
if (childEditPart instanceof SubstitutionAppliedStereotypeEditPart) {
- ((SubstitutionAppliedStereotypeEditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel());
+ ((SubstitutionAppliedStereotypeEditPart) childEditPart).setLabel(
+ getPrimaryShape().getAppliedStereotypeLabel());
}
return false;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/SubstitutionNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/SubstitutionNameEditPart.java
index 602f06b7b59..a0c1d7acd1d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/SubstitutionNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/SubstitutionNameEditPart.java
@@ -1,789 +1,828 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.component.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.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.component.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.component.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 SubstitutionNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
- /**
- * @generated
- */
- public static final int VISUAL_ID = 6006;
-
- /**
- * @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.component.edit.parts.SubstitutionNameEditPart.VISUAL_ID), new Point(0, 60));
- }
-
- /**
- * @generated
- */
- public SubstitutionNameEditPart(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());
- }
-
- /**
- * @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
- */
- 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.Substitution_4012, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.edit.parts.SubstitutionNameEditPart.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() {
- // 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.component.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.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.component.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.component.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 SubstitutionNameEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 6006;
+
+ /**
+ * @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.component.edit.parts.SubstitutionNameEditPart.VISUAL_ID), new Point(0, 60));
+ }
+
+ /**
+ * @generated
+ */
+ public SubstitutionNameEditPart(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.Substitution_4012, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.component.edit.parts.SubstitutionNameEditPart.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() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/UMLEditPartFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/UMLEditPartFactory.java
index 48432353f01..02d5380ec7a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/UMLEditPartFactory.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/UMLEditPartFactory.java
@@ -38,172 +38,269 @@ public class UMLEditPartFactory implements EditPartFactory {
if (model instanceof View) {
View view = (View) model;
switch (UMLVisualIDRegistry.getVisualID(view)) {
+
case ComponentDiagramEditPart.VISUAL_ID:
return new ComponentDiagramEditPart(view);
+
case DependencyNodeEditPart.VISUAL_ID:
return new DependencyNodeEditPart(view);
+
case MultiDependencyLabelEditPart.VISUAL_ID:
return new MultiDependencyLabelEditPart(view);
+
case ComponentEditPart.VISUAL_ID:
return new ComponentEditPart(view);
+
case ComponentNameEditPart.VISUAL_ID:
return new ComponentNameEditPart(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 RectangleInterfaceEditPart.VISUAL_ID:
return new RectangleInterfaceEditPart(view);
+
case RectangleInterfaceNameEditPart.VISUAL_ID:
return new RectangleInterfaceNameEditPart(view);
+
case CommentEditPart.VISUAL_ID:
return new CommentEditPart(view);
+
case CommentBodyEditPart.VISUAL_ID:
return new CommentBodyEditPart(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 DefaultNamedElementEditPart.VISUAL_ID:
return new DefaultNamedElementEditPart(view);
+
case DefaultNamedElementNameEditPart.VISUAL_ID:
return new DefaultNamedElementNameEditPart(view);
+
case InterfaceEditPart.VISUAL_ID:
return new InterfaceEditPart(view);
+
case InterfaceNameEditPart.VISUAL_ID:
return new InterfaceNameEditPart(view);
+
case PortEditPart.VISUAL_ID:
return new PortEditPart(view);
+
case PortNameEditPart.VISUAL_ID:
return new PortNameEditPart(view);
+
case PortAppliedStereotypeEditPart.VISUAL_ID:
return new PortAppliedStereotypeEditPart(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 RectangleInterfaceEditPartCN.VISUAL_ID:
return new RectangleInterfaceEditPartCN(view);
+
case RectangleInterfaceNameEditPartCN.VISUAL_ID:
return new RectangleInterfaceNameEditPartCN(view);
+
case ComponentEditPartCN.VISUAL_ID:
return new ComponentEditPartCN(view);
+
case ComponentNameEditPartCN.VISUAL_ID:
return new ComponentNameEditPartCN(view);
+
case ComponentEditPartPCN.VISUAL_ID:
return new ComponentEditPartPCN(view);
+
case ComponentNameEditPartPCN.VISUAL_ID:
return new ComponentNameEditPartPCN(view);
+
case CommentEditPartPCN.VISUAL_ID:
return new CommentEditPartPCN(view);
+
case CommentBodyEditPartPCN.VISUAL_ID:
return new CommentBodyEditPartPCN(view);
+
case ConstraintEditPartPCN.VISUAL_ID:
return new ConstraintEditPartPCN(view);
+
case ConstraintNameEditPartPCN.VISUAL_ID:
return new ConstraintNameEditPartPCN(view);
+
case ConstraintSpecificationEditPartPCN.VISUAL_ID:
return new ConstraintSpecificationEditPartPCN(view);
+
case PropertyForInterfaceEditPart.VISUAL_ID:
return new PropertyForInterfaceEditPart(view);
+
case OperationForInterfaceEditPart.VISUAL_ID:
return new OperationForInterfaceEditPart(view);
+
case ReceptionInInterfaceEditPart.VISUAL_ID:
return new ReceptionInInterfaceEditPart(view);
+
case InterfaceEditPartPCN.VISUAL_ID:
return new InterfaceEditPartPCN(view);
+
case InterfaceNameEditPartPCN.VISUAL_ID:
return new InterfaceNameEditPartPCN(view);
+
case PropertyPartEditPartCN.VISUAL_ID:
return new PropertyPartEditPartCN(view);
+
case PropertyPartNameEditPartCN.VISUAL_ID:
return new PropertyPartNameEditPartCN(view);
+
case ComponentCompositeCompartmentEditPart.VISUAL_ID:
return new ComponentCompositeCompartmentEditPart(view);
+
case ModelPackageableElementCompartmentEditPart.VISUAL_ID:
return new ModelPackageableElementCompartmentEditPart(view);
+
case PackagePackageableElementCompartmentEditPart.VISUAL_ID:
return new PackagePackageableElementCompartmentEditPart(view);
+
case ModelPackageableElementCompartmentEditPartCN.VISUAL_ID:
return new ModelPackageableElementCompartmentEditPartCN(view);
+
case PackagePackageableElementCompartmentEditPartCN.VISUAL_ID:
return new PackagePackageableElementCompartmentEditPartCN(view);
+
case ComponentCompositeCompartmentEditPartCN.VISUAL_ID:
return new ComponentCompositeCompartmentEditPartCN(view);
+
case ComponentCompositeCompartmentEditPartPCN.VISUAL_ID:
return new ComponentCompositeCompartmentEditPartPCN(view);
+
case InterfaceAttributeCompartmentEditPart.VISUAL_ID:
return new InterfaceAttributeCompartmentEditPart(view);
+
case InterfaceOperationCompartmentEditPart.VISUAL_ID:
return new InterfaceOperationCompartmentEditPart(view);
+
case InterfaceAttributeCompartmentEditPartCN.VISUAL_ID:
return new InterfaceAttributeCompartmentEditPartCN(view);
+
case InterfaceOperationCompartmentEditPartCN.VISUAL_ID:
return new InterfaceOperationCompartmentEditPartCN(view);
+
case UsageEditPart.VISUAL_ID:
return new UsageEditPart(view);
+
+
case InterfaceRealizationEditPart.VISUAL_ID:
return new InterfaceRealizationEditPart(view);
+
+
case GeneralizationEditPart.VISUAL_ID:
return new GeneralizationEditPart(view);
+
case GeneralizationAppliedStereotypeEditPart.VISUAL_ID:
return new GeneralizationAppliedStereotypeEditPart(view);
+
+
case SubstitutionEditPart.VISUAL_ID:
return new SubstitutionEditPart(view);
+
case SubstitutionNameEditPart.VISUAL_ID:
return new SubstitutionNameEditPart(view);
+
case SubstitutionAppliedStereotypeEditPart.VISUAL_ID:
return new SubstitutionAppliedStereotypeEditPart(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 ComponentRealizationEditPart.VISUAL_ID:
return new ComponentRealizationEditPart(view);
+
case ComponentRealizationNameEditPart.VISUAL_ID:
return new ComponentRealizationNameEditPart(view);
+
case ComponentRealizationAppliedStereotypeEditPart.VISUAL_ID:
return new ComponentRealizationAppliedStereotypeEditPart(view);
+
+
case AbstractionEditPart.VISUAL_ID:
return new AbstractionEditPart(view);
+
case AbstractionNameEditPart.VISUAL_ID:
return new AbstractionNameEditPart(view);
+
case AbstractionAppliedStereotypeEditPart.VISUAL_ID:
return new AbstractionAppliedStereotypeEditPart(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 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);
+
+
case InterfacePortLinkEditPart.VISUAL_ID:
return new InterfacePortLinkEditPart(view);
+
+
case ConnectorEditPart.VISUAL_ID:
return new ConnectorEditPart(view);
+
case ConnectorAppliedStereotypeEditPart.VISUAL_ID:
return new ConnectorAppliedStereotypeEditPart(view);
+
case ConnectorNameEditPart.VISUAL_ID:
return new ConnectorNameEditPart(view);
+
}
}
return createUnrecognizedEditPart(context, model);
@@ -222,9 +319,12 @@ public class UMLEditPartFactory implements EditPartFactory {
*/
public static CellEditorLocator getTextCellEditorLocator(ITextAwareEditPart source) {
if (source.getFigure() instanceof IMultilineEditableFigure) {
- return new MultilineCellEditorLocator((IMultilineEditableFigure) source.getFigure());
- } else {
+ return new MultilineCellEditorLocator(
+ (IMultilineEditableFigure) source.getFigure());
+ }
+ else {
return CellEditorLocatorAccess.INSTANCE.getTextCellEditorLocator(source);
+
}
}
@@ -263,7 +363,8 @@ public class UMLEditPartFactory implements EditPartFactory {
rect.y = getMultilineEditableFigure().getEditionLocation().y;
getMultilineEditableFigure().translateToAbsolute(rect);
if (getMultilineEditableFigure().getText().length() > 0) {
- rect.setSize(new Dimension(text.computeSize(rect.width, SWT.DEFAULT)));
+ 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.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/AbstractionItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/AbstractionItemSemanticEditPolicy.java
index 904b752968f..79c42864188 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/AbstractionItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/AbstractionItemSemanticEditPolicy.java
@@ -71,6 +71,7 @@ public class AbstractionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPo
if (provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
+
if (deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -83,7 +84,8 @@ public class AbstractionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPo
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -111,37 +113,43 @@ public class AbstractionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPo
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
return null;
@@ -153,13 +161,15 @@ public class AbstractionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPo
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
@@ -188,7 +198,8 @@ public class AbstractionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPo
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
return null;
@@ -197,49 +208,57 @@ public class AbstractionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPo
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/CommentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/CommentItemSemanticEditPolicy.java
index 186b905358e..279d1ad47b9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/CommentItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/CommentItemSemanticEditPolicy.java
@@ -54,6 +54,7 @@ public class CommentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy
if (provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
+
if (deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -66,7 +67,8 @@ public class CommentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -94,7 +96,8 @@ public class CommentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
return null;
@@ -126,13 +129,15 @@ public class CommentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/CommentItemSemanticEditPolicyPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/CommentItemSemanticEditPolicyPCN.java
index 50203ddec3b..9d1dd93db55 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/CommentItemSemanticEditPolicyPCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/CommentItemSemanticEditPolicyPCN.java
@@ -54,6 +54,7 @@ public class CommentItemSemanticEditPolicyPCN extends UMLBaseItemSemanticEditPol
if (provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
+
if (deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -66,7 +67,8 @@ public class CommentItemSemanticEditPolicyPCN extends UMLBaseItemSemanticEditPol
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -94,7 +96,8 @@ public class CommentItemSemanticEditPolicyPCN extends UMLBaseItemSemanticEditPol
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ConstraintConstrainedElement_4009 == baseElementType) {
return null;
@@ -126,13 +129,15 @@ public class CommentItemSemanticEditPolicyPCN extends UMLBaseItemSemanticEditPol
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCanonicalEditPolicy.java
index d571330d56c..72ae415ef5a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCanonicalEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCanonicalEditPolicy.java
@@ -70,7 +70,8 @@ public class ComponentCanonicalEditPolicy extends CanonicalEditPolicy {
protected List<EObject> getSemanticChildrenList() {
View viewObject = (View) getHost().getModel();
LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getComponent_2002SemanticChildren(viewObject);
+ List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
+ .getComponent_2002SemanticChildren(viewObject);
for (UMLNodeDescriptor d : childDescriptors) {
result.add(d.getModelElement());
}
@@ -101,7 +102,9 @@ public class ComponentCanonicalEditPolicy extends CanonicalEditPolicy {
return;
}
LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getComponent_2002SemanticChildren((View) getHost().getModel());
+ List<UMLNodeDescriptor> childDescriptors =
+ UMLDiagramUpdater.INSTANCE
+ .getComponent_2002SemanticChildren((View) getHost().getModel());
LinkedList<View> orphaned = new LinkedList<View>();
// we care to check only views we recognize as ours
LinkedList<View> knownViewChildren = new LinkedList<View>();
@@ -147,6 +150,7 @@ public class ComponentCanonicalEditPolicy extends CanonicalEditPolicy {
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);
@@ -166,6 +170,7 @@ public class ComponentCanonicalEditPolicy extends CanonicalEditPolicy {
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.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCanonicalEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCanonicalEditPolicyCN.java
index edc2befb18c..cd366e7f837 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCanonicalEditPolicyCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCanonicalEditPolicyCN.java
@@ -70,7 +70,8 @@ public class ComponentCanonicalEditPolicyCN extends CanonicalEditPolicy {
protected List<EObject> getSemanticChildrenList() {
View viewObject = (View) getHost().getModel();
LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getComponent_3070SemanticChildren(viewObject);
+ List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
+ .getComponent_3070SemanticChildren(viewObject);
for (UMLNodeDescriptor d : childDescriptors) {
result.add(d.getModelElement());
}
@@ -101,7 +102,9 @@ public class ComponentCanonicalEditPolicyCN extends CanonicalEditPolicy {
return;
}
LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getComponent_3070SemanticChildren((View) getHost().getModel());
+ List<UMLNodeDescriptor> childDescriptors =
+ UMLDiagramUpdater.INSTANCE
+ .getComponent_3070SemanticChildren((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>();
@@ -147,6 +150,7 @@ public class ComponentCanonicalEditPolicyCN extends CanonicalEditPolicy {
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);
@@ -166,6 +170,7 @@ public class ComponentCanonicalEditPolicyCN extends CanonicalEditPolicy {
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.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCanonicalEditPolicyPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCanonicalEditPolicyPCN.java
index ffa3ec6ebf9..81b70e6c50e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCanonicalEditPolicyPCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCanonicalEditPolicyPCN.java
@@ -70,7 +70,8 @@ public class ComponentCanonicalEditPolicyPCN extends CanonicalEditPolicy {
protected List<EObject> getSemanticChildrenList() {
View viewObject = (View) getHost().getModel();
LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getComponent_3071SemanticChildren(viewObject);
+ List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
+ .getComponent_3071SemanticChildren(viewObject);
for (UMLNodeDescriptor d : childDescriptors) {
result.add(d.getModelElement());
}
@@ -101,7 +102,9 @@ public class ComponentCanonicalEditPolicyPCN extends CanonicalEditPolicy {
return;
}
LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getComponent_3071SemanticChildren((View) getHost().getModel());
+ List<UMLNodeDescriptor> childDescriptors =
+ UMLDiagramUpdater.INSTANCE
+ .getComponent_3071SemanticChildren((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>();
@@ -147,6 +150,7 @@ public class ComponentCanonicalEditPolicyPCN extends CanonicalEditPolicy {
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);
@@ -166,6 +170,7 @@ public class ComponentCanonicalEditPolicyPCN extends CanonicalEditPolicy {
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.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentCanonicalEditPolicy.java
index 1d749809bd3..50f96c0105c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentCanonicalEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentCanonicalEditPolicy.java
@@ -83,7 +83,8 @@ public class ComponentCompositeCompartmentCanonicalEditPolicy extends CanonicalE
protected List<EObject> getSemanticChildrenList() {
View viewObject = (View) getHost().getModel();
LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getComponentPackagedelements_7001SemanticChildren(viewObject);
+ List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
+ .getComponentPackagedelements_7001SemanticChildren(viewObject);
for (UMLNodeDescriptor d : childDescriptors) {
result.add(d.getModelElement());
}
@@ -115,7 +116,9 @@ public class ComponentCompositeCompartmentCanonicalEditPolicy extends CanonicalE
return;
}
LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getComponentPackagedelements_7001SemanticChildren((View) getHost().getModel());
+ List<UMLNodeDescriptor> childDescriptors =
+ UMLDiagramUpdater.INSTANCE
+ .getComponentPackagedelements_7001SemanticChildren((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>();
@@ -161,6 +164,7 @@ public class ComponentCompositeCompartmentCanonicalEditPolicy extends CanonicalE
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);
@@ -180,6 +184,7 @@ public class ComponentCompositeCompartmentCanonicalEditPolicy extends CanonicalE
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.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentCanonicalEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentCanonicalEditPolicyCN.java
index f19d1e7316a..6464c2b164c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentCanonicalEditPolicyCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentCanonicalEditPolicyCN.java
@@ -83,7 +83,8 @@ public class ComponentCompositeCompartmentCanonicalEditPolicyCN extends Canonica
protected List<EObject> getSemanticChildrenList() {
View viewObject = (View) getHost().getModel();
LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getComponentPackagedelements_7003SemanticChildren(viewObject);
+ List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
+ .getComponentPackagedelements_7003SemanticChildren(viewObject);
for (UMLNodeDescriptor d : childDescriptors) {
result.add(d.getModelElement());
}
@@ -115,7 +116,9 @@ public class ComponentCompositeCompartmentCanonicalEditPolicyCN extends Canonica
return;
}
LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getComponentPackagedelements_7003SemanticChildren((View) getHost().getModel());
+ List<UMLNodeDescriptor> childDescriptors =
+ UMLDiagramUpdater.INSTANCE
+ .getComponentPackagedelements_7003SemanticChildren((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>();
@@ -161,6 +164,7 @@ public class ComponentCompositeCompartmentCanonicalEditPolicyCN extends Canonica
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);
@@ -180,6 +184,7 @@ public class ComponentCompositeCompartmentCanonicalEditPolicyCN extends Canonica
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.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentCanonicalEditPolicyPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentCanonicalEditPolicyPCN.java
index 793575f106b..ba99c2b1819 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentCanonicalEditPolicyPCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentCanonicalEditPolicyPCN.java
@@ -83,7 +83,8 @@ public class ComponentCompositeCompartmentCanonicalEditPolicyPCN extends Canonic
protected List<EObject> getSemanticChildrenList() {
View viewObject = (View) getHost().getModel();
LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getComponentPackagedelements_7004SemanticChildren(viewObject);
+ List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
+ .getComponentPackagedelements_7004SemanticChildren(viewObject);
for (UMLNodeDescriptor d : childDescriptors) {
result.add(d.getModelElement());
}
@@ -115,7 +116,9 @@ public class ComponentCompositeCompartmentCanonicalEditPolicyPCN extends Canonic
return;
}
LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getComponentPackagedelements_7004SemanticChildren((View) getHost().getModel());
+ List<UMLNodeDescriptor> childDescriptors =
+ UMLDiagramUpdater.INSTANCE
+ .getComponentPackagedelements_7004SemanticChildren((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>();
@@ -161,6 +164,7 @@ public class ComponentCompositeCompartmentCanonicalEditPolicyPCN extends Canonic
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);
@@ -180,6 +184,7 @@ public class ComponentCompositeCompartmentCanonicalEditPolicyPCN extends Canonic
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.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicy.java
index 9895fc38918..404dba00db8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicy.java
@@ -40,11 +40,17 @@ public class ComponentCompositeCompartmentItemSemanticEditPolicy extends UMLBase
if (requestElementType == null) {
return super.getCreateCommand(req);
}
+
+
if (UMLElementTypes.Component_3070 == requestElementType) {
+
return getGEFWrapper(new ComponentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Property_3079 == requestElementType) {
+
return getGEFWrapper(new PropertyCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicyCN.java
index ab877352a70..702d99fe40b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicyCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicyCN.java
@@ -40,11 +40,17 @@ public class ComponentCompositeCompartmentItemSemanticEditPolicyCN extends UMLBa
if (requestElementType == null) {
return super.getCreateCommand(req);
}
+
+
if (UMLElementTypes.Component_3070 == requestElementType) {
+
return getGEFWrapper(new ComponentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Property_3079 == requestElementType) {
+
return getGEFWrapper(new PropertyCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicyPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicyPCN.java
index 813ad50dbdd..9a95064f849 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicyPCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicyPCN.java
@@ -40,11 +40,17 @@ public class ComponentCompositeCompartmentItemSemanticEditPolicyPCN extends UMLB
if (requestElementType == null) {
return super.getCreateCommand(req);
}
+
+
if (UMLElementTypes.Component_3070 == requestElementType) {
+
return getGEFWrapper(new ComponentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Property_3079 == requestElementType) {
+
return getGEFWrapper(new PropertyCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentDiagramItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentDiagramItemSemanticEditPolicy.java
index 0a8f7ae71d3..47f9bd31b6d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentDiagramItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentDiagramItemSemanticEditPolicy.java
@@ -51,32 +51,52 @@ public class ComponentDiagramItemSemanticEditPolicy extends UMLBaseItemSemanticE
if (requestElementType == null) {
return super.getCreateCommand(req);
}
+
+
if (UMLElementTypes.Dependency_3203 == requestElementType) {
+
return getGEFWrapper(new DependencyNodeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Component_2002 == requestElementType) {
+
return getGEFWrapper(new ComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Model_3202 == requestElementType) {
+
return getGEFWrapper(new ModelCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Package_3200 == requestElementType) {
+
return getGEFWrapper(new PackageCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Interface_3205 == requestElementType) {
+
return getGEFWrapper(new RectangleInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Comment_3201 == requestElementType) {
+
return getGEFWrapper(new CommentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Constraint_3199 == requestElementType) {
+
return getGEFWrapper(new ConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.NamedElement_3204 == requestElementType) {
+
return getGEFWrapper(new DefaultNamedElementCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Interface_2003 == requestElementType) {
+
return getGEFWrapper(new InterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicy.java
index a04b5714788..2dd4714ccba 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicy.java
@@ -75,8 +75,12 @@ public class ComponentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPoli
if (requestElementType == null) {
return super.getCreateCommand(req);
}
+
+
if (UMLElementTypes.Port_3069 == requestElementType) {
+
return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
return super.getCreateCommand(req);
}
@@ -91,6 +95,7 @@ public class ComponentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPoli
if (provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
+
if (deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -103,7 +108,8 @@ public class ComponentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPoli
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -131,43 +137,50 @@ public class ComponentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPoli
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(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()));
+ return getGEFWrapper(new GeneralizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
return null;
@@ -179,13 +192,15 @@ public class ComponentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPoli
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
@@ -214,7 +229,8 @@ public class ComponentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPoli
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
return null;
@@ -223,55 +239,64 @@ public class ComponentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPoli
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new GeneralizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicyCN.java
index 3c9be62e6d5..e4d51573bba 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicyCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicyCN.java
@@ -75,8 +75,12 @@ public class ComponentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPo
if (requestElementType == null) {
return super.getCreateCommand(req);
}
+
+
if (UMLElementTypes.Port_3069 == requestElementType) {
+
return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
return super.getCreateCommand(req);
}
@@ -91,6 +95,7 @@ public class ComponentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPo
if (provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
+
if (deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -103,7 +108,8 @@ public class ComponentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPo
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -131,43 +137,50 @@ public class ComponentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPo
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(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()));
+ return getGEFWrapper(new GeneralizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
return null;
@@ -179,13 +192,15 @@ public class ComponentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPo
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
@@ -214,7 +229,8 @@ public class ComponentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPo
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
return null;
@@ -223,55 +239,64 @@ public class ComponentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPo
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new GeneralizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicyPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicyPCN.java
index 3e0a1b71c3e..7b7c673f181 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicyPCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicyPCN.java
@@ -75,8 +75,12 @@ public class ComponentItemSemanticEditPolicyPCN extends UMLBaseItemSemanticEditP
if (requestElementType == null) {
return super.getCreateCommand(req);
}
+
+
if (UMLElementTypes.Port_3069 == requestElementType) {
+
return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
return super.getCreateCommand(req);
}
@@ -91,6 +95,7 @@ public class ComponentItemSemanticEditPolicyPCN extends UMLBaseItemSemanticEditP
if (provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
+
if (deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -103,7 +108,8 @@ public class ComponentItemSemanticEditPolicyPCN extends UMLBaseItemSemanticEditP
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -131,43 +137,50 @@ public class ComponentItemSemanticEditPolicyPCN extends UMLBaseItemSemanticEditP
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(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()));
+ return getGEFWrapper(new GeneralizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
return null;
@@ -179,13 +192,15 @@ public class ComponentItemSemanticEditPolicyPCN extends UMLBaseItemSemanticEditP
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
@@ -214,7 +229,8 @@ public class ComponentItemSemanticEditPolicyPCN extends UMLBaseItemSemanticEditP
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
return null;
@@ -223,55 +239,64 @@ public class ComponentItemSemanticEditPolicyPCN extends UMLBaseItemSemanticEditP
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new GeneralizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentRealizationItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentRealizationItemSemanticEditPolicy.java
index c6224bce33c..7a4a1114586 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentRealizationItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentRealizationItemSemanticEditPolicy.java
@@ -71,6 +71,7 @@ public class ComponentRealizationItemSemanticEditPolicy extends UMLBaseItemSeman
if (provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
+
if (deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -83,7 +84,8 @@ public class ComponentRealizationItemSemanticEditPolicy extends UMLBaseItemSeman
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -111,37 +113,43 @@ public class ComponentRealizationItemSemanticEditPolicy extends UMLBaseItemSeman
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
return null;
@@ -153,13 +161,15 @@ public class ComponentRealizationItemSemanticEditPolicy extends UMLBaseItemSeman
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
@@ -188,7 +198,8 @@ public class ComponentRealizationItemSemanticEditPolicy extends UMLBaseItemSeman
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
return null;
@@ -197,49 +208,57 @@ public class ComponentRealizationItemSemanticEditPolicy extends UMLBaseItemSeman
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ConnectorItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ConnectorItemSemanticEditPolicy.java
index b1a0ecc13c8..78f32227ba3 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ConnectorItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ConnectorItemSemanticEditPolicy.java
@@ -71,6 +71,7 @@ public class ConnectorItemSemanticEditPolicy extends UMLBaseItemSemanticEditPoli
if (provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
+
if (deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -83,7 +84,8 @@ public class ConnectorItemSemanticEditPolicy extends UMLBaseItemSemanticEditPoli
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -111,37 +113,43 @@ public class ConnectorItemSemanticEditPolicy extends UMLBaseItemSemanticEditPoli
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
return null;
@@ -153,13 +161,15 @@ public class ConnectorItemSemanticEditPolicy extends UMLBaseItemSemanticEditPoli
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
@@ -188,7 +198,8 @@ public class ConnectorItemSemanticEditPolicy extends UMLBaseItemSemanticEditPoli
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
return null;
@@ -197,49 +208,57 @@ public class ConnectorItemSemanticEditPolicy extends UMLBaseItemSemanticEditPoli
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ConstraintItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ConstraintItemSemanticEditPolicy.java
index d11ae226905..9283786c8f6 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ConstraintItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ConstraintItemSemanticEditPolicy.java
@@ -71,6 +71,7 @@ public class ConstraintItemSemanticEditPolicy extends UMLBaseItemSemanticEditPol
if (provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
+
if (deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -83,7 +84,8 @@ public class ConstraintItemSemanticEditPolicy extends UMLBaseItemSemanticEditPol
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -111,37 +113,43 @@ public class ConstraintItemSemanticEditPolicy extends UMLBaseItemSemanticEditPol
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
return null;
@@ -150,19 +158,22 @@ public class ConstraintItemSemanticEditPolicy extends UMLBaseItemSemanticEditPol
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
@@ -191,7 +202,8 @@ public class ConstraintItemSemanticEditPolicy extends UMLBaseItemSemanticEditPol
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
return null;
@@ -200,49 +212,57 @@ public class ConstraintItemSemanticEditPolicy extends UMLBaseItemSemanticEditPol
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ConstraintItemSemanticEditPolicyPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ConstraintItemSemanticEditPolicyPCN.java
index 3ec995faf04..30e26bac2e1 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ConstraintItemSemanticEditPolicyPCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ConstraintItemSemanticEditPolicyPCN.java
@@ -71,6 +71,7 @@ public class ConstraintItemSemanticEditPolicyPCN extends UMLBaseItemSemanticEdit
if (provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
+
if (deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -83,7 +84,8 @@ public class ConstraintItemSemanticEditPolicyPCN extends UMLBaseItemSemanticEdit
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -111,37 +113,43 @@ public class ConstraintItemSemanticEditPolicyPCN extends UMLBaseItemSemanticEdit
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
return null;
@@ -150,19 +158,22 @@ public class ConstraintItemSemanticEditPolicyPCN extends UMLBaseItemSemanticEdit
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
@@ -191,7 +202,8 @@ public class ConstraintItemSemanticEditPolicyPCN extends UMLBaseItemSemanticEdit
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
return null;
@@ -200,49 +212,57 @@ public class ConstraintItemSemanticEditPolicyPCN extends UMLBaseItemSemanticEdit
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/DefaultNamedElementItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/DefaultNamedElementItemSemanticEditPolicy.java
index a4acc9f2857..c2acbace1a1 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/DefaultNamedElementItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/DefaultNamedElementItemSemanticEditPolicy.java
@@ -83,7 +83,7 @@ public class DefaultNamedElementItemSemanticEditPolicy extends UMLBaseItemSemant
// 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 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));
@@ -96,7 +96,8 @@ public class DefaultNamedElementItemSemanticEditPolicy extends UMLBaseItemSemant
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -124,37 +125,43 @@ public class DefaultNamedElementItemSemanticEditPolicy extends UMLBaseItemSemant
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
return null;
@@ -166,13 +173,15 @@ public class DefaultNamedElementItemSemanticEditPolicy extends UMLBaseItemSemant
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
@@ -201,7 +210,8 @@ public class DefaultNamedElementItemSemanticEditPolicy extends UMLBaseItemSemant
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
return null;
@@ -210,49 +220,57 @@ public class DefaultNamedElementItemSemanticEditPolicy extends UMLBaseItemSemant
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/DependencyBranchItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/DependencyBranchItemSemanticEditPolicy.java
index b4b1a3dfd2c..3bcb27dcb6c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/DependencyBranchItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/DependencyBranchItemSemanticEditPolicy.java
@@ -71,6 +71,7 @@ public class DependencyBranchItemSemanticEditPolicy extends UMLBaseItemSemanticE
if (provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
+
if (deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -83,7 +84,8 @@ public class DependencyBranchItemSemanticEditPolicy extends UMLBaseItemSemanticE
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -111,37 +113,43 @@ public class DependencyBranchItemSemanticEditPolicy extends UMLBaseItemSemanticE
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
return null;
@@ -153,13 +161,15 @@ public class DependencyBranchItemSemanticEditPolicy extends UMLBaseItemSemanticE
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
@@ -188,7 +198,8 @@ public class DependencyBranchItemSemanticEditPolicy extends UMLBaseItemSemanticE
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
return null;
@@ -197,49 +208,57 @@ public class DependencyBranchItemSemanticEditPolicy extends UMLBaseItemSemanticE
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/DependencyItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/DependencyItemSemanticEditPolicy.java
index 3dfbf7e66de..a11207a6368 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/DependencyItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/DependencyItemSemanticEditPolicy.java
@@ -71,6 +71,7 @@ public class DependencyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPol
if (provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
+
if (deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -83,7 +84,8 @@ public class DependencyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPol
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -111,37 +113,43 @@ public class DependencyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPol
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
return null;
@@ -153,13 +161,15 @@ public class DependencyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPol
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
@@ -188,7 +198,8 @@ public class DependencyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPol
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
return null;
@@ -197,49 +208,57 @@ public class DependencyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPol
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/DependencyNodeItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/DependencyNodeItemSemanticEditPolicy.java
index 02d7c3361b1..ab112cf24a7 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/DependencyNodeItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/DependencyNodeItemSemanticEditPolicy.java
@@ -71,6 +71,7 @@ public class DependencyNodeItemSemanticEditPolicy extends UMLBaseItemSemanticEdi
if (provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
+
if (deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -83,7 +84,8 @@ public class DependencyNodeItemSemanticEditPolicy extends UMLBaseItemSemanticEdi
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -111,37 +113,43 @@ public class DependencyNodeItemSemanticEditPolicy extends UMLBaseItemSemanticEdi
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
return null;
@@ -153,13 +161,15 @@ public class DependencyNodeItemSemanticEditPolicy extends UMLBaseItemSemanticEdi
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
@@ -188,7 +198,8 @@ public class DependencyNodeItemSemanticEditPolicy extends UMLBaseItemSemanticEdi
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
return null;
@@ -197,49 +208,57 @@ public class DependencyNodeItemSemanticEditPolicy extends UMLBaseItemSemanticEdi
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/GeneralizationItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/GeneralizationItemSemanticEditPolicy.java
index 00bb5a6cd36..17acd7a6e2a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/GeneralizationItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/GeneralizationItemSemanticEditPolicy.java
@@ -54,6 +54,7 @@ public class GeneralizationItemSemanticEditPolicy extends UMLBaseItemSemanticEdi
if (provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
+
if (deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -66,7 +67,8 @@ public class GeneralizationItemSemanticEditPolicy extends UMLBaseItemSemanticEdi
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -120,13 +122,15 @@ public class GeneralizationItemSemanticEditPolicy extends UMLBaseItemSemanticEdi
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentCanonicalEditPolicy.java
index b9058150482..8f926cb94d4 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentCanonicalEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentCanonicalEditPolicy.java
@@ -70,7 +70,8 @@ public class InterfaceAttributeCompartmentCanonicalEditPolicy extends CanonicalE
protected List<EObject> getSemanticChildrenList() {
View viewObject = (View) getHost().getModel();
LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getInterfaceAttributes_7008SemanticChildren(viewObject);
+ List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
+ .getInterfaceAttributes_7008SemanticChildren(viewObject);
for (UMLNodeDescriptor d : childDescriptors) {
result.add(d.getModelElement());
}
@@ -101,7 +102,9 @@ public class InterfaceAttributeCompartmentCanonicalEditPolicy extends CanonicalE
return;
}
LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getInterfaceAttributes_7008SemanticChildren((View) getHost().getModel());
+ List<UMLNodeDescriptor> childDescriptors =
+ UMLDiagramUpdater.INSTANCE
+ .getInterfaceAttributes_7008SemanticChildren((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>();
@@ -147,6 +150,7 @@ public class InterfaceAttributeCompartmentCanonicalEditPolicy extends CanonicalE
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);
@@ -166,6 +170,7 @@ public class InterfaceAttributeCompartmentCanonicalEditPolicy extends CanonicalE
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.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentCanonicalEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentCanonicalEditPolicyCN.java
index 3f0c1891c04..b167de4f5fb 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentCanonicalEditPolicyCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentCanonicalEditPolicyCN.java
@@ -70,7 +70,8 @@ public class InterfaceAttributeCompartmentCanonicalEditPolicyCN extends Canonica
protected List<EObject> getSemanticChildrenList() {
View viewObject = (View) getHost().getModel();
LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getInterfaceAttributes_7010SemanticChildren(viewObject);
+ List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
+ .getInterfaceAttributes_7010SemanticChildren(viewObject);
for (UMLNodeDescriptor d : childDescriptors) {
result.add(d.getModelElement());
}
@@ -101,7 +102,9 @@ public class InterfaceAttributeCompartmentCanonicalEditPolicyCN extends Canonica
return;
}
LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getInterfaceAttributes_7010SemanticChildren((View) getHost().getModel());
+ List<UMLNodeDescriptor> childDescriptors =
+ UMLDiagramUpdater.INSTANCE
+ .getInterfaceAttributes_7010SemanticChildren((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>();
@@ -147,6 +150,7 @@ public class InterfaceAttributeCompartmentCanonicalEditPolicyCN extends Canonica
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);
@@ -166,6 +170,7 @@ public class InterfaceAttributeCompartmentCanonicalEditPolicyCN extends Canonica
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.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicy.java
index 3b2a203c48d..62681741294 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicy.java
@@ -39,8 +39,12 @@ public class InterfaceAttributeCompartmentItemSemanticEditPolicy extends UMLBase
if (requestElementType == null) {
return super.getCreateCommand(req);
}
+
+
if (UMLElementTypes.Property_1 == requestElementType) {
+
return getGEFWrapper(new PropertyForInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicyCN.java
index ccb12616da4..23354e66306 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicyCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicyCN.java
@@ -39,8 +39,12 @@ public class InterfaceAttributeCompartmentItemSemanticEditPolicyCN extends UMLBa
if (requestElementType == null) {
return super.getCreateCommand(req);
}
+
+
if (UMLElementTypes.Property_1 == requestElementType) {
+
return getGEFWrapper(new PropertyForInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceItemSemanticEditPolicy.java
index b640e355d1c..a0693493699 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceItemSemanticEditPolicy.java
@@ -97,7 +97,7 @@ public class InterfaceItemSemanticEditPolicy extends UMLBaseItemSemanticEditPoli
// 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 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));
@@ -118,6 +118,11 @@ public class InterfaceItemSemanticEditPolicy extends UMLBaseItemSemanticEditPoli
Node cnode = (Node) cit.next();
switch (UMLVisualIDRegistry.getVisualID(cnode)) {
case PropertyForInterfaceEditPart.VISUAL_ID:
+
+
+
+
+
for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge) it.next();
switch (UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -135,6 +140,11 @@ public class InterfaceItemSemanticEditPolicy extends UMLBaseItemSemanticEditPoli
Node cnode = (Node) cit.next();
switch (UMLVisualIDRegistry.getVisualID(cnode)) {
case OperationForInterfaceEditPart.VISUAL_ID:
+
+
+
+
+
for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge) it.next();
switch (UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -145,6 +155,11 @@ public class InterfaceItemSemanticEditPolicy extends UMLBaseItemSemanticEditPoli
// cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
case ReceptionInInterfaceEditPart.VISUAL_ID:
+
+
+
+
+
for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge) it.next();
switch (UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -166,7 +181,8 @@ public class InterfaceItemSemanticEditPolicy extends UMLBaseItemSemanticEditPoli
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -194,43 +210,50 @@ public class InterfaceItemSemanticEditPolicy extends UMLBaseItemSemanticEditPoli
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(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()));
+ return getGEFWrapper(new GeneralizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
return null;
@@ -242,13 +265,15 @@ public class InterfaceItemSemanticEditPolicy extends UMLBaseItemSemanticEditPoli
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
@@ -277,67 +302,78 @@ public class InterfaceItemSemanticEditPolicy extends UMLBaseItemSemanticEditPoli
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(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()));
+ return getGEFWrapper(new GeneralizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceItemSemanticEditPolicyPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceItemSemanticEditPolicyPCN.java
index fb1cb31693b..1d6644e2756 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceItemSemanticEditPolicyPCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceItemSemanticEditPolicyPCN.java
@@ -73,6 +73,7 @@ public class InterfaceItemSemanticEditPolicyPCN extends UMLBaseItemSemanticEditP
if (provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
+
if (deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -85,7 +86,8 @@ public class InterfaceItemSemanticEditPolicyPCN extends UMLBaseItemSemanticEditP
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -113,43 +115,50 @@ public class InterfaceItemSemanticEditPolicyPCN extends UMLBaseItemSemanticEditP
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(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()));
+ return getGEFWrapper(new GeneralizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
return null;
@@ -161,13 +170,15 @@ public class InterfaceItemSemanticEditPolicyPCN extends UMLBaseItemSemanticEditP
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
@@ -196,67 +207,78 @@ public class InterfaceItemSemanticEditPolicyPCN extends UMLBaseItemSemanticEditP
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(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()));
+ return getGEFWrapper(new GeneralizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentCanonicalEditPolicy.java
index 237483ef7bc..e8f1210b947 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentCanonicalEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentCanonicalEditPolicy.java
@@ -83,7 +83,8 @@ public class InterfaceOperationCompartmentCanonicalEditPolicy extends CanonicalE
protected List<EObject> getSemanticChildrenList() {
View viewObject = (View) getHost().getModel();
LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getInterfaceOperations_7009SemanticChildren(viewObject);
+ List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
+ .getInterfaceOperations_7009SemanticChildren(viewObject);
for (UMLNodeDescriptor d : childDescriptors) {
result.add(d.getModelElement());
}
@@ -115,7 +116,9 @@ public class InterfaceOperationCompartmentCanonicalEditPolicy extends CanonicalE
return;
}
LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getInterfaceOperations_7009SemanticChildren((View) getHost().getModel());
+ List<UMLNodeDescriptor> childDescriptors =
+ UMLDiagramUpdater.INSTANCE
+ .getInterfaceOperations_7009SemanticChildren((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>();
@@ -161,6 +164,7 @@ public class InterfaceOperationCompartmentCanonicalEditPolicy extends CanonicalE
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);
@@ -180,6 +184,7 @@ public class InterfaceOperationCompartmentCanonicalEditPolicy extends CanonicalE
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.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentCanonicalEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentCanonicalEditPolicyCN.java
index 18adfc620c0..7409978dfe1 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentCanonicalEditPolicyCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentCanonicalEditPolicyCN.java
@@ -83,7 +83,8 @@ public class InterfaceOperationCompartmentCanonicalEditPolicyCN extends Canonica
protected List<EObject> getSemanticChildrenList() {
View viewObject = (View) getHost().getModel();
LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getInterfaceOperations_7011SemanticChildren(viewObject);
+ List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
+ .getInterfaceOperations_7011SemanticChildren(viewObject);
for (UMLNodeDescriptor d : childDescriptors) {
result.add(d.getModelElement());
}
@@ -115,7 +116,9 @@ public class InterfaceOperationCompartmentCanonicalEditPolicyCN extends Canonica
return;
}
LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getInterfaceOperations_7011SemanticChildren((View) getHost().getModel());
+ List<UMLNodeDescriptor> childDescriptors =
+ UMLDiagramUpdater.INSTANCE
+ .getInterfaceOperations_7011SemanticChildren((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>();
@@ -161,6 +164,7 @@ public class InterfaceOperationCompartmentCanonicalEditPolicyCN extends Canonica
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);
@@ -180,6 +184,7 @@ public class InterfaceOperationCompartmentCanonicalEditPolicyCN extends Canonica
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.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicy.java
index a0644d53b04..361e1ee23c1 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicy.java
@@ -40,11 +40,17 @@ public class InterfaceOperationCompartmentItemSemanticEditPolicy extends UMLBase
if (requestElementType == null) {
return super.getCreateCommand(req);
}
+
+
if (UMLElementTypes.Operation_5 == requestElementType) {
+
return getGEFWrapper(new OperationForInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Reception_6 == requestElementType) {
+
return getGEFWrapper(new ReceptionInInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicyCN.java
index bb501a6bc04..d6612526ebf 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicyCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicyCN.java
@@ -40,11 +40,17 @@ public class InterfaceOperationCompartmentItemSemanticEditPolicyCN extends UMLBa
if (requestElementType == null) {
return super.getCreateCommand(req);
}
+
+
if (UMLElementTypes.Operation_5 == requestElementType) {
+
return getGEFWrapper(new OperationForInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Reception_6 == requestElementType) {
+
return getGEFWrapper(new ReceptionInInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceRealizationItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceRealizationItemSemanticEditPolicy.java
index 2df9d27b90c..be7fe08ea01 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceRealizationItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceRealizationItemSemanticEditPolicy.java
@@ -71,6 +71,7 @@ public class InterfaceRealizationItemSemanticEditPolicy extends UMLBaseItemSeman
if (provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
+
if (deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -83,7 +84,8 @@ public class InterfaceRealizationItemSemanticEditPolicy extends UMLBaseItemSeman
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -111,37 +113,43 @@ public class InterfaceRealizationItemSemanticEditPolicy extends UMLBaseItemSeman
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
return null;
@@ -153,13 +161,15 @@ public class InterfaceRealizationItemSemanticEditPolicy extends UMLBaseItemSeman
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
@@ -188,7 +198,8 @@ public class InterfaceRealizationItemSemanticEditPolicy extends UMLBaseItemSeman
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
return null;
@@ -197,49 +208,57 @@ public class InterfaceRealizationItemSemanticEditPolicy extends UMLBaseItemSeman
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ManifestationItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ManifestationItemSemanticEditPolicy.java
index fb2bda02d30..6f7f74d7853 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ManifestationItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ManifestationItemSemanticEditPolicy.java
@@ -71,6 +71,7 @@ public class ManifestationItemSemanticEditPolicy extends UMLBaseItemSemanticEdit
if (provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
+
if (deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -83,7 +84,8 @@ public class ManifestationItemSemanticEditPolicy extends UMLBaseItemSemanticEdit
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -111,37 +113,43 @@ public class ManifestationItemSemanticEditPolicy extends UMLBaseItemSemanticEdit
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
return null;
@@ -153,13 +161,15 @@ public class ManifestationItemSemanticEditPolicy extends UMLBaseItemSemanticEdit
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
@@ -188,7 +198,8 @@ public class ManifestationItemSemanticEditPolicy extends UMLBaseItemSemanticEdit
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
return null;
@@ -197,49 +208,57 @@ public class ManifestationItemSemanticEditPolicy extends UMLBaseItemSemanticEdit
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelCanonicalEditPolicy.java
index 72eb9078d4f..5e59200e537 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelCanonicalEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelCanonicalEditPolicy.java
@@ -131,7 +131,8 @@ public class ModelCanonicalEditPolicy extends CanonicalEditPolicy {
protected List<EObject> getSemanticChildrenList() {
View viewObject = (View) getHost().getModel();
LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getPackage_1000SemanticChildren(viewObject);
+ List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
+ .getPackage_1000SemanticChildren(viewObject);
for (UMLNodeDescriptor d : childDescriptors) {
result.add(d.getModelElement());
}
@@ -175,7 +176,9 @@ public class ModelCanonicalEditPolicy extends CanonicalEditPolicy {
return;
}
LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getPackage_1000SemanticChildren((View) getHost().getModel());
+ 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>();
@@ -250,6 +253,7 @@ public class ModelCanonicalEditPolicy extends CanonicalEditPolicy {
}
}
}
+
boolean changed = deleteViews(orphaned.iterator());
//
CreateViewRequest request = getCreateViewRequest(viewDescriptors);
@@ -267,13 +271,17 @@ public class ModelCanonicalEditPolicy extends CanonicalEditPolicy {
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);
}
@@ -284,8 +292,10 @@ public class ModelCanonicalEditPolicy extends CanonicalEditPolicy {
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) {
+ for (Object edge : getDiagram().getEdges())
+ {
+ if (edge instanceof View)
+ {
edges.add((View) edge);
}
}
@@ -326,210 +336,240 @@ public class ModelCanonicalEditPolicy extends CanonicalEditPolicy {
switch (UMLVisualIDRegistry.getVisualID(view)) {
case ComponentDiagramEditPart.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getPackage_1000ContainedLinks(view));
+ 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_3203ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getDependency_3203ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case ComponentEditPart.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getComponent_2002ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getComponent_2002ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case ModelEditPart.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getModel_3202ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getModel_3202ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case PackageEditPart.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getPackage_3200ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getPackage_3200ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case RectangleInterfaceEditPart.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getInterface_3205ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getInterface_3205ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case CommentEditPart.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getComment_3201ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getComment_3201ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case ConstraintEditPart.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getConstraint_3199ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getConstraint_3199ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case DefaultNamedElementEditPart.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getNamedElement_3204ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getNamedElement_3204ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case InterfaceEditPart.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getInterface_2003ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getInterface_2003ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case PortEditPart.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getPort_3069ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getPort_3069ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case ModelEditPartCN.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getModel_3077ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getModel_3077ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case PackageEditPartCN.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getPackage_3076ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getPackage_3076ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case RectangleInterfaceEditPartCN.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getInterface_3078ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getInterface_3078ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case ComponentEditPartCN.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getComponent_3070ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getComponent_3070ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case ComponentEditPartPCN.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getComponent_3071ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getComponent_3071ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case CommentEditPartPCN.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getComment_3074ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getComment_3074ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case ConstraintEditPartPCN.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getConstraint_3075ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getConstraint_3075ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case InterfaceEditPartPCN.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getInterface_3072ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getInterface_3072ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case PropertyPartEditPartCN.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getProperty_3079ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getProperty_3079ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case UsageEditPart.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getUsage_4001ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getUsage_4001ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case InterfaceRealizationEditPart.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getInterfaceRealization_4006ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getInterfaceRealization_4006ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case GeneralizationEditPart.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getGeneralization_4003ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getGeneralization_4003ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case SubstitutionEditPart.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getSubstitution_4012ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getSubstitution_4012ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case ManifestationEditPart.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getManifestation_4014ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getManifestation_4014ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case ComponentRealizationEditPart.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getComponentRealization_4007ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getComponentRealization_4007ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case AbstractionEditPart.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getAbstraction_4013ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getAbstraction_4013ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case DependencyEditPart.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getDependency_4010ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getDependency_4010ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case DependencyBranchEditPart.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getDependency_4017ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getDependency_4017ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
}
case ConnectorEditPart.VISUAL_ID: {
if (!domain2NotationMap.containsKey(view.getElement())) {
- result.addAll(UMLDiagramUpdater.INSTANCE.getConnector_4019ContainedLinks(view));
+ result.addAll(UMLDiagramUpdater.INSTANCE
+ .getConnector_4019ContainedLinks(view));
}
domain2NotationMap.putView(view.getElement(), view);
break;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelItemSemanticEditPolicy.java
index e1b44e387f9..f8fada22301 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelItemSemanticEditPolicy.java
@@ -101,7 +101,7 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
// 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 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));
@@ -122,6 +122,11 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
Node cnode = (Node) cit.next();
switch (UMLVisualIDRegistry.getVisualID(cnode)) {
case RectangleInterfaceEditPartCN.VISUAL_ID:
+
+
+
+
+
for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge) it.next();
switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -146,11 +151,17 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
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 ModelEditPartCN.VISUAL_ID:
+
+
+
+
+
for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge) it.next();
switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -173,11 +184,17 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
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)) {
@@ -200,11 +217,17 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
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 ComponentEditPartPCN.VISUAL_ID:
+
+
+
+
+
for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge) it.next();
switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -228,11 +251,17 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
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 CommentEditPartPCN.VISUAL_ID:
+
+
+
+
+
for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge) it.next();
switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -244,11 +273,17 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
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 ConstraintEditPartPCN.VISUAL_ID:
+
+
+
+
+
for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge) it.next();
switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -271,11 +306,17 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
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 InterfaceEditPartPCN.VISUAL_ID:
+
+
+
+
+
for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge) it.next();
switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -300,6 +341,7 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
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));
@@ -316,7 +358,8 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -344,37 +387,43 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
return null;
@@ -386,13 +435,15 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
@@ -421,7 +472,8 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
return null;
@@ -430,49 +482,57 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelItemSemanticEditPolicyCN.java
index 24dc20eb0e2..f644d0de4a9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelItemSemanticEditPolicyCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelItemSemanticEditPolicyCN.java
@@ -101,7 +101,7 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy
// 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 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));
@@ -122,6 +122,11 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy
Node cnode = (Node) cit.next();
switch (UMLVisualIDRegistry.getVisualID(cnode)) {
case RectangleInterfaceEditPartCN.VISUAL_ID:
+
+
+
+
+
for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge) it.next();
switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -146,11 +151,17 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy
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 ModelEditPartCN.VISUAL_ID:
+
+
+
+
+
for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge) it.next();
switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -173,11 +184,17 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy
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)) {
@@ -200,11 +217,17 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy
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 ComponentEditPartPCN.VISUAL_ID:
+
+
+
+
+
for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge) it.next();
switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -228,11 +251,17 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy
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 CommentEditPartPCN.VISUAL_ID:
+
+
+
+
+
for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge) it.next();
switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -244,11 +273,17 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy
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 ConstraintEditPartPCN.VISUAL_ID:
+
+
+
+
+
for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge) it.next();
switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -271,11 +306,17 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy
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 InterfaceEditPartPCN.VISUAL_ID:
+
+
+
+
+
for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge) it.next();
switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -300,6 +341,7 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy
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));
@@ -316,7 +358,8 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -344,37 +387,43 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
return null;
@@ -386,13 +435,15 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
@@ -421,7 +472,8 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
return null;
@@ -430,49 +482,57 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicy.java
index d98f341ba21..5be7372ebc2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicy.java
@@ -99,7 +99,8 @@ public class ModelPackageableElementCompartmentCanonicalEditPolicy extends Canon
protected List<EObject> getSemanticChildrenList() {
View viewObject = (View) getHost().getModel();
LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getModelPackagedelements_7006SemanticChildren(viewObject);
+ List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
+ .getModelPackagedelements_7006SemanticChildren(viewObject);
for (UMLNodeDescriptor d : childDescriptors) {
result.add(d.getModelElement());
}
@@ -141,7 +142,9 @@ public class ModelPackageableElementCompartmentCanonicalEditPolicy extends Canon
return;
}
LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getModelPackagedelements_7006SemanticChildren((View) getHost().getModel());
+ List<UMLNodeDescriptor> childDescriptors =
+ UMLDiagramUpdater.INSTANCE
+ .getModelPackagedelements_7006SemanticChildren((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>();
@@ -216,6 +219,7 @@ public class ModelPackageableElementCompartmentCanonicalEditPolicy extends Canon
}
}
}
+
boolean changed = deleteViews(orphaned.iterator());
//
CreateViewRequest request = getCreateViewRequest(viewDescriptors);
@@ -238,6 +242,7 @@ public class ModelPackageableElementCompartmentCanonicalEditPolicy extends Canon
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.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicyCN.java
index 9601c62eb58..87de05440d8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicyCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicyCN.java
@@ -99,7 +99,8 @@ public class ModelPackageableElementCompartmentCanonicalEditPolicyCN extends Can
protected List<EObject> getSemanticChildrenList() {
View viewObject = (View) getHost().getModel();
LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getModelPackagedelements_7007SemanticChildren(viewObject);
+ List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
+ .getModelPackagedelements_7007SemanticChildren(viewObject);
for (UMLNodeDescriptor d : childDescriptors) {
result.add(d.getModelElement());
}
@@ -141,7 +142,9 @@ public class ModelPackageableElementCompartmentCanonicalEditPolicyCN extends Can
return;
}
LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getModelPackagedelements_7007SemanticChildren((View) getHost().getModel());
+ List<UMLNodeDescriptor> childDescriptors =
+ UMLDiagramUpdater.INSTANCE
+ .getModelPackagedelements_7007SemanticChildren((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>();
@@ -216,6 +219,7 @@ public class ModelPackageableElementCompartmentCanonicalEditPolicyCN extends Can
}
}
}
+
boolean changed = deleteViews(orphaned.iterator());
//
CreateViewRequest request = getCreateViewRequest(viewDescriptors);
@@ -238,6 +242,7 @@ public class ModelPackageableElementCompartmentCanonicalEditPolicyCN extends Can
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.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicy.java
index 9043247445f..df6894fef17 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicy.java
@@ -45,26 +45,42 @@ public class ModelPackageableElementCompartmentItemSemanticEditPolicy extends UM
if (requestElementType == null) {
return super.getCreateCommand(req);
}
+
+
if (UMLElementTypes.Interface_3078 == requestElementType) {
+
return getGEFWrapper(new InterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Model_3077 == requestElementType) {
+
return getGEFWrapper(new ModelCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Package_3076 == requestElementType) {
+
return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Component_3071 == requestElementType) {
+
return getGEFWrapper(new ComponentCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Comment_3074 == requestElementType) {
+
return getGEFWrapper(new CommentCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Constraint_3075 == requestElementType) {
+
return getGEFWrapper(new ConstraintCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Interface_3072 == requestElementType) {
+
return getGEFWrapper(new InterfaceCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyCN.java
index e9b6f4bff1d..6477afc7bc9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyCN.java
@@ -45,26 +45,42 @@ public class ModelPackageableElementCompartmentItemSemanticEditPolicyCN extends
if (requestElementType == null) {
return super.getCreateCommand(req);
}
+
+
if (UMLElementTypes.Interface_3078 == requestElementType) {
+
return getGEFWrapper(new InterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Model_3077 == requestElementType) {
+
return getGEFWrapper(new ModelCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Package_3076 == requestElementType) {
+
return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Component_3071 == requestElementType) {
+
return getGEFWrapper(new ComponentCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Comment_3074 == requestElementType) {
+
return getGEFWrapper(new CommentCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Constraint_3075 == requestElementType) {
+
return getGEFWrapper(new ConstraintCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Interface_3072 == requestElementType) {
+
return getGEFWrapper(new InterfaceCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/OperationForInterfaceItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/OperationForInterfaceItemSemanticEditPolicy.java
index ec124f84e05..0139db74db1 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/OperationForInterfaceItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/OperationForInterfaceItemSemanticEditPolicy.java
@@ -51,7 +51,7 @@ public class OperationForInterfaceItemSemanticEditPolicy extends UMLBaseItemSema
// 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 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));
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackageItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackageItemSemanticEditPolicy.java
index d91690e1a48..cfdd5edd96e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackageItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackageItemSemanticEditPolicy.java
@@ -71,6 +71,7 @@ public class PackageItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy
if (provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
+
if (deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -83,7 +84,8 @@ public class PackageItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -111,37 +113,43 @@ public class PackageItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
return null;
@@ -153,13 +161,15 @@ public class PackageItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
@@ -188,7 +198,8 @@ public class PackageItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
return null;
@@ -197,49 +208,57 @@ public class PackageItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackageItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackageItemSemanticEditPolicyCN.java
index 2a682f1f450..c78437eb405 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackageItemSemanticEditPolicyCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackageItemSemanticEditPolicyCN.java
@@ -71,6 +71,7 @@ public class PackageItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPoli
if (provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
+
if (deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -83,7 +84,8 @@ public class PackageItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPoli
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -111,37 +113,43 @@ public class PackageItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPoli
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
return null;
@@ -153,13 +161,15 @@ public class PackageItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPoli
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
@@ -188,7 +198,8 @@ public class PackageItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPoli
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
return null;
@@ -197,49 +208,57 @@ public class PackageItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPoli
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicy.java
index e1b45b6fb30..ccade8f2334 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicy.java
@@ -99,7 +99,8 @@ public class PackagePackageableElementCompartmentCanonicalEditPolicy extends Can
protected List<EObject> getSemanticChildrenList() {
View viewObject = (View) getHost().getModel();
LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getPackagePackagedelements_7002SemanticChildren(viewObject);
+ List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
+ .getPackagePackagedelements_7002SemanticChildren(viewObject);
for (UMLNodeDescriptor d : childDescriptors) {
result.add(d.getModelElement());
}
@@ -141,7 +142,9 @@ public class PackagePackageableElementCompartmentCanonicalEditPolicy extends Can
return;
}
LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getPackagePackagedelements_7002SemanticChildren((View) getHost().getModel());
+ List<UMLNodeDescriptor> childDescriptors =
+ UMLDiagramUpdater.INSTANCE
+ .getPackagePackagedelements_7002SemanticChildren((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>();
@@ -216,6 +219,7 @@ public class PackagePackageableElementCompartmentCanonicalEditPolicy extends Can
}
}
}
+
boolean changed = deleteViews(orphaned.iterator());
//
CreateViewRequest request = getCreateViewRequest(viewDescriptors);
@@ -238,6 +242,7 @@ public class PackagePackageableElementCompartmentCanonicalEditPolicy extends Can
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.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicyCN.java
index 79e6a0613d4..57a077d5074 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicyCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicyCN.java
@@ -99,7 +99,8 @@ public class PackagePackageableElementCompartmentCanonicalEditPolicyCN extends C
protected List<EObject> getSemanticChildrenList() {
View viewObject = (View) getHost().getModel();
LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getPackagePackagedelements_7005SemanticChildren(viewObject);
+ List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
+ .getPackagePackagedelements_7005SemanticChildren(viewObject);
for (UMLNodeDescriptor d : childDescriptors) {
result.add(d.getModelElement());
}
@@ -141,7 +142,9 @@ public class PackagePackageableElementCompartmentCanonicalEditPolicyCN extends C
return;
}
LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getPackagePackagedelements_7005SemanticChildren((View) getHost().getModel());
+ List<UMLNodeDescriptor> childDescriptors =
+ UMLDiagramUpdater.INSTANCE
+ .getPackagePackagedelements_7005SemanticChildren((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>();
@@ -216,6 +219,7 @@ public class PackagePackageableElementCompartmentCanonicalEditPolicyCN extends C
}
}
}
+
boolean changed = deleteViews(orphaned.iterator());
//
CreateViewRequest request = getCreateViewRequest(viewDescriptors);
@@ -238,6 +242,7 @@ public class PackagePackageableElementCompartmentCanonicalEditPolicyCN extends C
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.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java
index 08f3c4f8ada..779528f28f6 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java
@@ -45,26 +45,42 @@ public class PackagePackageableElementCompartmentItemSemanticEditPolicy extends
if (requestElementType == null) {
return super.getCreateCommand(req);
}
+
+
if (UMLElementTypes.Interface_3078 == requestElementType) {
+
return getGEFWrapper(new InterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Comment_3074 == requestElementType) {
+
return getGEFWrapper(new CommentCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Constraint_3075 == requestElementType) {
+
return getGEFWrapper(new ConstraintCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Component_3071 == requestElementType) {
+
return getGEFWrapper(new ComponentCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Model_3077 == requestElementType) {
+
return getGEFWrapper(new ModelCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Package_3076 == requestElementType) {
+
return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Interface_3072 == requestElementType) {
+
return getGEFWrapper(new InterfaceCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicyCN.java
index 757b7bdca11..f9febb04db3 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicyCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicyCN.java
@@ -45,26 +45,42 @@ public class PackagePackageableElementCompartmentItemSemanticEditPolicyCN extend
if (requestElementType == null) {
return super.getCreateCommand(req);
}
+
+
if (UMLElementTypes.Interface_3078 == requestElementType) {
+
return getGEFWrapper(new InterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Model_3077 == requestElementType) {
+
return getGEFWrapper(new ModelCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Package_3076 == requestElementType) {
+
return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Component_3071 == requestElementType) {
+
return getGEFWrapper(new ComponentCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Comment_3074 == requestElementType) {
+
return getGEFWrapper(new CommentCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Constraint_3075 == requestElementType) {
+
return getGEFWrapper(new ConstraintCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
if (UMLElementTypes.Interface_3072 == requestElementType) {
+
return getGEFWrapper(new InterfaceCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PortItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PortItemSemanticEditPolicy.java
index 92f293e0527..e4b0e8d7d2e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PortItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PortItemSemanticEditPolicy.java
@@ -71,6 +71,7 @@ public class PortItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
if (provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
+
if (deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -83,7 +84,8 @@ public class PortItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -111,37 +113,43 @@ public class PortItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
return null;
@@ -153,13 +161,15 @@ public class PortItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
@@ -188,7 +198,8 @@ public class PortItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
return null;
@@ -197,49 +208,57 @@ public class PortItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PropertyCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PropertyCanonicalEditPolicy.java
index f2d9e2fd7f3..45e0445166f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PropertyCanonicalEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PropertyCanonicalEditPolicy.java
@@ -70,7 +70,8 @@ public class PropertyCanonicalEditPolicy extends CanonicalEditPolicy {
protected List<EObject> getSemanticChildrenList() {
View viewObject = (View) getHost().getModel();
LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getProperty_3079SemanticChildren(viewObject);
+ List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE
+ .getProperty_3079SemanticChildren(viewObject);
for (UMLNodeDescriptor d : childDescriptors) {
result.add(d.getModelElement());
}
@@ -101,7 +102,9 @@ public class PropertyCanonicalEditPolicy extends CanonicalEditPolicy {
return;
}
LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getProperty_3079SemanticChildren((View) getHost().getModel());
+ List<UMLNodeDescriptor> childDescriptors =
+ UMLDiagramUpdater.INSTANCE
+ .getProperty_3079SemanticChildren((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>();
@@ -147,6 +150,7 @@ public class PropertyCanonicalEditPolicy extends CanonicalEditPolicy {
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);
@@ -166,6 +170,7 @@ public class PropertyCanonicalEditPolicy extends CanonicalEditPolicy {
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.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PropertyForInterfaceItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PropertyForInterfaceItemSemanticEditPolicy.java
index b583a135df5..1e0a8246adc 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PropertyForInterfaceItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PropertyForInterfaceItemSemanticEditPolicy.java
@@ -43,6 +43,7 @@ public class PropertyForInterfaceItemSemanticEditPolicy extends UMLBaseItemSeman
if (provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
+
if (deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PropertyItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PropertyItemSemanticEditPolicy.java
index 671529db9c2..712672bf0a9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PropertyItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PropertyItemSemanticEditPolicy.java
@@ -89,8 +89,12 @@ public class PropertyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic
if (requestElementType == null) {
return super.getCreateCommand(req);
}
+
+
if (UMLElementTypes.Port_3069 == requestElementType) {
+
return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
+
}
return super.getCreateCommand(req);
}
@@ -111,7 +115,7 @@ public class PropertyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic
// 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 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));
@@ -128,6 +132,11 @@ public class PropertyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic
Node node = (Node) nit.next();
switch (UMLVisualIDRegistry.getVisualID(node)) {
case PortEditPart.VISUAL_ID:
+
+
+
+
+
for (Iterator<?> it = node.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge) it.next();
switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -150,6 +159,7 @@ public class PropertyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic
break;
}
}
+
cmd.add(new DestroyElementCommand(new DestroyElementRequest(getEditingDomain(), node.getElement(), false))); // directlyOwned: false
// don't need explicit deletion of node as parent's view deletion would clean child views as well
// cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), node));
@@ -163,7 +173,8 @@ public class PropertyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -191,37 +202,43 @@ public class PropertyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
return null;
@@ -233,13 +250,15 @@ public class PropertyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
@@ -268,7 +287,8 @@ public class PropertyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
return null;
@@ -277,49 +297,57 @@ public class PropertyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ReceptionInInterfaceItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ReceptionInInterfaceItemSemanticEditPolicy.java
index 9646828861b..dae25291fdd 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ReceptionInInterfaceItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ReceptionInInterfaceItemSemanticEditPolicy.java
@@ -51,7 +51,7 @@ public class ReceptionInInterfaceItemSemanticEditPolicy extends UMLBaseItemSeman
// 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 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));
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/RectangleInterfaceItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/RectangleInterfaceItemSemanticEditPolicy.java
index f08bdc00704..e4cb6b834cf 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/RectangleInterfaceItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/RectangleInterfaceItemSemanticEditPolicy.java
@@ -97,7 +97,7 @@ public class RectangleInterfaceItemSemanticEditPolicy extends UMLBaseItemSemanti
// 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 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));
@@ -118,6 +118,11 @@ public class RectangleInterfaceItemSemanticEditPolicy extends UMLBaseItemSemanti
Node cnode = (Node) cit.next();
switch (UMLVisualIDRegistry.getVisualID(cnode)) {
case PropertyForInterfaceEditPart.VISUAL_ID:
+
+
+
+
+
for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge) it.next();
switch (UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -135,6 +140,11 @@ public class RectangleInterfaceItemSemanticEditPolicy extends UMLBaseItemSemanti
Node cnode = (Node) cit.next();
switch (UMLVisualIDRegistry.getVisualID(cnode)) {
case OperationForInterfaceEditPart.VISUAL_ID:
+
+
+
+
+
for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge) it.next();
switch (UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -145,6 +155,11 @@ public class RectangleInterfaceItemSemanticEditPolicy extends UMLBaseItemSemanti
// cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
case ReceptionInInterfaceEditPart.VISUAL_ID:
+
+
+
+
+
for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge) it.next();
switch (UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -166,7 +181,8 @@ public class RectangleInterfaceItemSemanticEditPolicy extends UMLBaseItemSemanti
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -194,43 +210,50 @@ public class RectangleInterfaceItemSemanticEditPolicy extends UMLBaseItemSemanti
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(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()));
+ return getGEFWrapper(new GeneralizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
return null;
@@ -242,13 +265,15 @@ public class RectangleInterfaceItemSemanticEditPolicy extends UMLBaseItemSemanti
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
@@ -277,67 +302,78 @@ public class RectangleInterfaceItemSemanticEditPolicy extends UMLBaseItemSemanti
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(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()));
+ return getGEFWrapper(new GeneralizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/SubstitutionItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/SubstitutionItemSemanticEditPolicy.java
index d4f05f4dded..eca8dae5216 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/SubstitutionItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/SubstitutionItemSemanticEditPolicy.java
@@ -75,10 +75,10 @@ public class SubstitutionItemSemanticEditPolicy extends UMLBaseItemSemanticEditP
cmd.setTransactionNestingEnabled(true);
List<EObject> todestroy = new ArrayList<EObject>();
todestroy.add(req.getElementToDestroy());
- // cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
+ //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
cmd.add(new EMFtoGMFCommandWrapper(new DeleteCommand(getEditingDomain(), todestroy)));
return getGEFWrapper(cmd.reduce());
- // return getGEFWrapper(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
+ //return getGEFWrapper(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
}
/**
@@ -86,7 +86,8 @@ public class SubstitutionItemSemanticEditPolicy extends UMLBaseItemSemanticEditP
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -114,37 +115,43 @@ public class SubstitutionItemSemanticEditPolicy extends UMLBaseItemSemanticEditP
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
return null;
@@ -156,13 +163,15 @@ public class SubstitutionItemSemanticEditPolicy extends UMLBaseItemSemanticEditP
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
@@ -191,7 +200,8 @@ public class SubstitutionItemSemanticEditPolicy extends UMLBaseItemSemanticEditP
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
return null;
@@ -200,49 +210,57 @@ public class SubstitutionItemSemanticEditPolicy extends UMLBaseItemSemanticEditP
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UMLBaseItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UMLBaseItemSemanticEditPolicy.java
index a6841408a3f..8c7398ad4a8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UMLBaseItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UMLBaseItemSemanticEditPolicy.java
@@ -349,6 +349,7 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
} else {
return getGEFWrapper(new MoveElementsCommand(req));
}
+
}
/**
@@ -423,49 +424,56 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
* @generated
*/
public boolean canCreateUsage_4001(Package container, NamedElement source, NamedElement target) {
- return canExistUsage_4001(container, null, source, target);
+ return canExistUsage_4001(
+ container, null, source, target);
}
/**
* @generated
*/
public boolean canCreateInterfaceRealization_4006(Package container, NamedElement source, Interface target) {
- return canExistInterfaceRealization_4006(container, null, source, target);
+ return canExistInterfaceRealization_4006(
+ container, null, source, target);
}
/**
* @generated
*/
public boolean canCreateGeneralization_4003(Classifier container, Classifier source, Classifier target) {
- return canExistGeneralization_4003(container, null, source, target);
+ return canExistGeneralization_4003(
+ container, null, source, target);
}
/**
* @generated
*/
public boolean canCreateSubstitution_4012(Package container, NamedElement source, NamedElement target) {
- return canExistSubstitution_4012(container, null, source, target);
+ return canExistSubstitution_4012(
+ container, null, source, target);
}
/**
* @generated
*/
public boolean canCreateManifestation_4014(Package container, NamedElement source, NamedElement target) {
- return canExistManifestation_4014(container, null, source, target);
+ return canExistManifestation_4014(
+ container, null, source, target);
}
/**
* @generated
*/
public boolean canCreateComponentRealization_4007(Package container, NamedElement source, NamedElement target) {
- return canExistComponentRealization_4007(container, null, source, target);
+ return canExistComponentRealization_4007(
+ container, null, source, target);
}
/**
* @generated
*/
public boolean canCreateAbstraction_4013(Package container, NamedElement source, NamedElement target) {
- return canExistAbstraction_4013(container, null, source, target);
+ return canExistAbstraction_4013(
+ container, null, source, target);
}
/**
@@ -480,11 +488,14 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
*/
public boolean canCreateCommentAnnotatedElement_4015(Comment source, Element target) {
if (source != null) {
- if (source.getAnnotatedElements().contains(target)) {
+ if (source.getAnnotatedElements()
+ .contains(target)) {
return false;
}
}
- return canExistCommentAnnotatedElement_4015(source, target);
+
+ return canExistCommentAnnotatedElement_4015(
+ source, target);
}
/**
@@ -492,25 +503,30 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
*/
public boolean canCreateConstraintConstrainedElement_4009(Constraint source, Element target) {
if (source != null) {
- if (source.getConstrainedElements().contains(target)) {
+ if (source.getConstrainedElements()
+ .contains(target)) {
return false;
}
}
- return canExistConstraintConstrainedElement_4009(source, target);
+
+ return canExistConstraintConstrainedElement_4009(
+ source, target);
}
/**
* @generated
*/
public boolean canCreateDependency_4010(Package container, NamedElement source, NamedElement target) {
- return canExistDependency_4010(container, null, source, target);
+ return canExistDependency_4010(
+ container, null, source, target);
}
/**
* @generated
*/
public boolean canCreateDependency_4017(Package container, NamedElement source, NamedElement target) {
- return canExistDependency_4017(container, null, source, target);
+ return canExistDependency_4017(
+ container, null, source, target);
}
/**
@@ -524,7 +540,8 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
* @generated
*/
public boolean canCreateConnector_4019(StructuredClassifier container, ConnectorEnd source, ConnectorEnd target) {
- return canExistConnector_4019(container, null, source, target);
+ return canExistConnector_4019(
+ container, null, source, target);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UMLTextNonResizableEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UMLTextNonResizableEditPolicy.java
index 5b123478b78..9a7e74f594f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UMLTextNonResizableEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UMLTextNonResizableEditPolicy.java
@@ -221,7 +221,6 @@ public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx impl
private FigureListener getHostPositionListener() {
if (hostPositionListener == null) {
hostPositionListener = new FigureListener() {
-
@Override
public void figureMoved(IFigure source) {
refreshFeedback();
@@ -236,7 +235,8 @@ public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx impl
*/
@Override
protected List<?> createSelectionHandles() {
- MoveHandle moveHandle = new MoveHandle((GraphicalEditPart) getHost());
+ 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.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UMLTextSelectionEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UMLTextSelectionEditPolicy.java
index 76151379ace..a665cae3bde 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UMLTextSelectionEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UMLTextSelectionEditPolicy.java
@@ -215,7 +215,6 @@ public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements I
private FigureListener getHostPositionListener() {
if (hostPositionListener == null) {
hostPositionListener = new FigureListener() {
-
@Override
public void figureMoved(IFigure source) {
refreshFeedback();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UsageItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UsageItemSemanticEditPolicy.java
index 2cba070f5f3..15c6889ead5 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UsageItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UsageItemSemanticEditPolicy.java
@@ -71,6 +71,7 @@ public class UsageItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
if (provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
+
if (deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -83,7 +84,8 @@ public class UsageItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
*/
@Override
protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
@@ -111,37 +113,43 @@ public class UsageItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new InterfaceRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new InterfaceRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Substitution_4012 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
return null;
@@ -153,13 +161,15 @@ public class UsageItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
@@ -188,7 +198,8 @@ public class UsageItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new UsageCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new UsageCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.InterfaceRealization_4006 == baseElementType) {
return null;
@@ -197,49 +208,57 @@ public class UsageItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new SubstitutionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new SubstitutionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Manifestation_4014 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ManifestationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ManifestationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.ComponentRealization_4007 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new ComponentRealizationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new ComponentRealizationCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Abstraction_4013 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new AbstractionCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AbstractionCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.CommentAnnotatedElement_4015 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ 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 getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4010 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
if (UMLElementTypes.Dependency_4017 == baseElementType) {
if (isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType);
}
- return getGEFWrapper(new DependencyBranchCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new DependencyBranchCreateCommand(req,
+ req.getSource(), req.getTarget()));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/parsers/MessageFormatParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/parsers/MessageFormatParser.java
index b1f58894c28..912386d7dd7 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/parsers/MessageFormatParser.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/parsers/MessageFormatParser.java
@@ -182,7 +182,12 @@ public class MessageFormatParser extends AbstractAttributeParser {
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 new ParserEditStatus(
+ UMLDiagramEditorPlugin.ID,
+ IParserEditStatus.UNEDITABLE,
+ NLS.bind(
+ Messages.MessageFormatParser_InvalidInputError,
+ new Integer(pos.getErrorIndex())));
}
return validateNewValues(values);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/DiagramEditorContextMenuProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/DiagramEditorContextMenuProvider.java
index 41a067759e4..b5ba6bbdc60 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/DiagramEditorContextMenuProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/DiagramEditorContextMenuProvider.java
@@ -45,11 +45,13 @@ public class DiagramEditorContextMenuProvider extends DiagramContextMenuProvider
public void buildContextMenu(final IMenuManager menu) {
getViewer().flush();
try {
- TransactionUtil.getEditingDomain((EObject) getViewer().getContents().getModel()).runExclusive(new Runnable() {
+ TransactionUtil.getEditingDomain(
+ (EObject) getViewer().getContents().getModel()).runExclusive(new Runnable() {
@Override
public void run() {
- ContributionItemService.getInstance().contributeToPopupMenu(DiagramEditorContextMenuProvider.this, part);
+ ContributionItemService.getInstance().contributeToPopupMenu(
+ DiagramEditorContextMenuProvider.this, part);
menu.remove(ActionIds.ACTION_DELETE_FROM_MODEL);
}
});
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLCreationWizard.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLCreationWizard.java
index 925f758e7d3..f943b51af63 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLCreationWizard.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLCreationWizard.java
@@ -116,6 +116,7 @@ public class UMLCreationWizard extends Wizard implements INewWizard {
diagramModelFilePage.setTitle(Messages.UMLCreationWizard_DiagramModelFilePageTitle);
diagramModelFilePage.setDescription(Messages.UMLCreationWizard_DiagramModelFilePageDescription);
addPage(diagramModelFilePage);
+
domainModelFilePage = new UMLCreationWizardPage("DomainModelFile", getSelection(), "PapyrusUMLComponent") { //$NON-NLS-1$ //$NON-NLS-2$
@Override
@@ -123,7 +124,8 @@ public class UMLCreationWizard extends Wizard implements INewWizard {
if (visible) {
String fileName = diagramModelFilePage.getFileName();
fileName = fileName.substring(0, fileName.length() - ".PapyrusUMLComponent_diagram".length()); //$NON-NLS-1$
- setFileName(UMLDiagramEditorUtil.getUniqueFileName(getContainerFullPath(), fileName, "PapyrusUMLComponent")); //$NON-NLS-1$
+ setFileName(UMLDiagramEditorUtil.getUniqueFileName(
+ getContainerFullPath(), fileName, "PapyrusUMLComponent")); //$NON-NLS-1$
}
super.setVisible(visible);
}
@@ -138,27 +140,34 @@ public class UMLCreationWizard extends Wizard implements INewWizard {
*/
@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());
+ 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());
+ ErrorDialog.openError(getContainer().getShell(),
+ Messages.UMLCreationWizardCreationError, null,
+ ((CoreException) e.getTargetException()).getStatus());
} else {
UMLDiagramEditorPlugin.getInstance().logError("Error creating diagram", e.getTargetException()); //$NON-NLS-1$
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLCreationWizardPage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLCreationWizardPage.java
index a9bb0816265..12e67e615af 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLCreationWizardPage.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLCreationWizardPage.java
@@ -74,7 +74,8 @@ public class UMLCreationWizardPage extends WizardNewFileCreationPage {
@Override
public void createControl(Composite parent) {
super.createControl(parent);
- setFileName(UMLDiagramEditorUtil.getUniqueFileName(getContainerFullPath(), getFileName(), getExtension()));
+ setFileName(UMLDiagramEditorUtil.getUniqueFileName(
+ getContainerFullPath(), getFileName(), getExtension()));
setPageComplete(validatePage());
}
@@ -88,7 +89,8 @@ public class UMLCreationWizardPage extends WizardNewFileCreationPage {
}
String extension = getExtension();
if (extension != null && !getFilePath().toString().endsWith("." + extension)) {
- setErrorMessage(NLS.bind(Messages.UMLCreationWizardPageExtensionError, extension));
+ setErrorMessage(NLS.bind(
+ Messages.UMLCreationWizardPageExtensionError, extension));
return false;
}
return true;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramEditor.java
index 381b293034d..9b61ce0c5bd 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramEditor.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramEditor.java
@@ -102,13 +102,17 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh
*/
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);
+
}
/**
@@ -221,7 +225,8 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh
@Override
protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
- DiagramEditorContextMenuProvider provider = new DiagramEditorContextMenuProvider(this, getDiagramGraphicalViewer());
+ DiagramEditorContextMenuProvider provider =
+ new DiagramEditorContextMenuProvider(this, getDiagramGraphicalViewer());
getDiagramGraphicalViewer().setContextMenu(provider);
getSite().registerContextMenu(ActionIds.DIAGRAM_EDITOR_CONTEXT_MENU, provider, getDiagramGraphicalViewer());
}
@@ -278,6 +283,7 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh
dirtyState.dispose();
dirtyState = null;
}
+
super.setUndoContext(context);
}
@@ -296,7 +302,8 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh
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());
+ PapyrusPaletteService.getInstance().updatePalette(getPaletteViewer().getPaletteRoot(), this,
+ getDefaultPaletteContent());
}
}
@@ -308,10 +315,12 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh
// remove palette service listener
// remove preference listener
PapyrusPaletteService.getInstance().removeProviderChangeListener(this);
+
if (dirtyState != null) {
dirtyState.dispose();
dirtyState = null;
}
+
super.dispose();
}
@@ -348,10 +357,13 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh
@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
@@ -373,7 +385,9 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh
* @return Palette Key Handler for the palette
*/
private KeyHandler getPaletteKeyHandler() {
+
if (paletteKeyHandler == null) {
+
paletteKeyHandler = new KeyHandler() {
/**
@@ -388,18 +402,27 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh
*/
@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;
}
@@ -408,7 +431,9 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh
* @return Palette Mouse listener for the palette
*/
private MouseListener getPaletteMouseListener() {
+
if (paletteMouseListener == null) {
+
paletteMouseListener = new MouseListener() {
/**
@@ -426,10 +451,13 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh
@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
@@ -451,11 +479,14 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh
getPaletteViewer().setActiveTool(null);
clearActiveTool = false;
}
+
}
};
+
}
return paletteMouseListener;
}
+
};
}
@@ -473,20 +504,23 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh
@Override
protected void initializeGraphicalViewer() {
super.initializeGraphicalViewer();
+
// Enable Drop
- getDiagramGraphicalViewer().addDropTargetListener(new DropTargetListener(getDiagramGraphicalViewer(), LocalSelectionTransfer.getTransfer()) {
+ 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 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();
+ }
+ });
- @Override
- protected TransactionalEditingDomain getTransactionalEditingDomain() {
- return getEditingDomain();
- }
- });
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramEditorPlugin.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramEditorPlugin.java
index 581a707a7ec..ecd5e9e487f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramEditorPlugin.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramEditorPlugin.java
@@ -99,6 +99,7 @@ public class UMLDiagramEditorPlugin extends AbstractUIPlugin {
adapterFactory = org.eclipse.papyrus.infra.gmfdiag.common.Activator.getInstance().getItemProvidersAdapterFactory();
DiagramPreferenceInitializer diagramPreferenceInitializer = new DiagramPreferenceInitializer();
diagramPreferenceInitializer.initializeDefaultPreferences();
+
}
/**
@@ -141,9 +142,12 @@ public class UMLDiagramEditorPlugin extends AbstractUIPlugin {
* @generated
*/
public ImageDescriptor getItemImageDescriptor(Object item) {
- IItemLabelProvider labelProvider = (IItemLabelProvider) adapterFactory.adapt(item, IItemLabelProvider.class);
+ IItemLabelProvider labelProvider =
+ (IItemLabelProvider) adapterFactory.adapt(
+ item, IItemLabelProvider.class);
if (labelProvider != null) {
- return ExtendedImageRegistry.getInstance().getImageDescriptor(labelProvider.getImage(item));
+ return ExtendedImageRegistry.getInstance().getImageDescriptor(
+ labelProvider.getImage(item));
}
return null;
}
@@ -174,7 +178,8 @@ public class UMLDiagramEditorPlugin extends AbstractUIPlugin {
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());
+ return AbstractUIPlugin.imageDescriptorFromPlugin(
+ p.segment(0), p.removeFirstSegments(1).makeAbsolute().toString());
} else {
return getBundledImageDescriptor(p.makeAbsolute().toString());
}
@@ -204,7 +209,8 @@ public class UMLDiagramEditorPlugin extends AbstractUIPlugin {
* @generated
*/
public static String getString(String key) {
- return Platform.getResourceString(getInstance().getBundle(), "%" + key); //$NON-NLS-1$
+ return Platform.getResourceString(
+ getInstance().getBundle(), "%" + key); //$NON-NLS-1$
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramEditorUtil.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramEditorUtil.java
index 15f399e2f3f..6c720da3872 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramEditorUtil.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramEditorUtil.java
@@ -110,7 +110,8 @@ public class UMLDiagramEditorUtil {
* @generated
*/
public static String getUniqueFileName(IPath containerFullPath, String fileName, String extension) {
- return DefaultDiagramEditorUtil.getUniqueFileName(containerFullPath, fileName, extension, DefaultDiagramEditorUtil.EXISTS_IN_WORKSPACE);
+ return DefaultDiagramEditorUtil.getUniqueFileName(containerFullPath, fileName, extension,
+ DefaultDiagramEditorUtil.EXISTS_IN_WORKSPACE);
}
/**
@@ -143,21 +144,25 @@ public class UMLDiagramEditorUtil {
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, ComponentDiagramEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+
+ Diagram diagram = ViewService.createDiagram(
+ model,
+ ComponentDiagramEditPart.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.component.part.UMLDiagramEditorUtil.getSaveOptions());
diagramResource.save(org.eclipse.papyrus.uml.diagram.component.part.UMLDiagramEditorUtil.getSaveOptions());
} catch (IOException e) {
+
UMLDiagramEditorPlugin.getInstance().logError("Unable to store model and diagram resources", e); //$NON-NLS-1$
}
return CommandResult.newOKCommandResult();
@@ -177,7 +182,6 @@ public class UMLDiagramEditorUtil {
* Create a new instance of domain element associated with canvas.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
private static Package createInitialModel() {
@@ -188,7 +192,6 @@ public class UMLDiagramEditorUtil {
* Store model element in the resource.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
private static void attachModelToResource(Package model, Resource resource) {
@@ -200,6 +203,7 @@ public class UMLDiagramEditorUtil {
*/
public static void selectElementsInDiagram(IDiagramWorkbenchPart diagramPart, List<EditPart> editParts) {
diagramPart.getDiagramGraphicalViewer().deselectAll();
+
EditPart firstPrimary = null;
for (EditPart nextPart : editParts) {
diagramPart.getDiagramGraphicalViewer().appendSelection(nextPart);
@@ -207,6 +211,7 @@ public class UMLDiagramEditorUtil {
firstPrimary = nextPart;
}
}
+
if (!editParts.isEmpty()) {
diagramPart.getDiagramGraphicalViewer().reveal(firstPrimary != null ? firstPrimary : (EditPart) editParts.get(0));
}
@@ -218,6 +223,7 @@ public class UMLDiagramEditorUtil {
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) {
@@ -225,6 +231,7 @@ public class UMLDiagramEditorUtil {
return 1;
}
}
+
String elementID = EMFCoreUtil.getProxyID(element);
@SuppressWarnings("unchecked")
List<EditPart> associatedParts = viewer.findEditPartsForElement(elementID, IGraphicalEditPart.class);
@@ -238,6 +245,7 @@ public class UMLDiagramEditorUtil {
editPartCollector.add(nextPart);
}
}
+
if (intialNumOfEditParts == editPartCollector.size()) {
if (!associatedParts.isEmpty()) {
editPartCollector.add(associatedParts.get(0));
@@ -258,6 +266,7 @@ public class UMLDiagramEditorUtil {
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()) {
@@ -266,6 +275,7 @@ public class UMLDiagramEditorUtil {
EditPart editPart = editPartHolder.get(0);
view = editPart.getModel() instanceof View ? (View) editPart.getModel() : null;
}
+
return (view == null) ? diagramEditPart.getDiagramView() : view;
}
@@ -314,6 +324,7 @@ public class UMLDiagramEditorUtil {
}
}
}
+
buildElement2ViewMap(scope, element2ViewMap, elementSet);
}
return element2ViewMap;
@@ -326,6 +337,7 @@ public class UMLDiagramEditorUtil {
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()) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramUpdateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramUpdateCommand.java
index a7016abf933..cb23c455947 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramUpdateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramUpdateCommand.java
@@ -63,6 +63,7 @@ public class UMLDiagramUpdateCommand implements IHandler {
CanonicalEditPolicy nextEditPolicy = (CanonicalEditPolicy) it.next();
nextEditPolicy.refresh();
}
+
}
}
return null;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramUpdater.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramUpdater.java
index ab355a1744a..f626ac617c3 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramUpdater.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramUpdater.java
@@ -113,7 +113,7 @@ public class UMLDiagramUpdater implements DiagramUpdater {
* @generated
*/
protected UMLDiagramUpdater() {
- // to prevent instantiation allowing the override
+ //to prevent instantiation allowing the override
}
/**
@@ -167,7 +167,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
}
Package modelElement = (Package) view.getElement();
LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for (Iterator<?> it = modelElement.getPackagedElements().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getPackagedElements()
+ .iterator(); it.hasNext();) {
PackageableElement childElement = (PackageableElement) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == DependencyNodeEditPart.VISUAL_ID) {
@@ -191,7 +192,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
continue;
}
}
- for (Iterator<?> it = modelElement.getOwnedTypes().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getOwnedTypes()
+ .iterator(); it.hasNext();) {
Type childElement = (Type) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == ComponentEditPart.VISUAL_ID) {
@@ -203,7 +205,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
continue;
}
}
- for (Iterator<?> it = modelElement.getOwnedComments().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getOwnedComments()
+ .iterator(); it.hasNext();) {
Comment childElement = (Comment) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == CommentEditPart.VISUAL_ID) {
@@ -211,7 +214,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
continue;
}
}
- for (Iterator<?> it = modelElement.getOwnedRules().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getOwnedRules()
+ .iterator(); it.hasNext();) {
Constraint childElement = (Constraint) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == ConstraintEditPart.VISUAL_ID) {
@@ -231,7 +235,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
}
Component modelElement = (Component) view.getElement();
LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for (Iterator<?> it = modelElement.getOwnedAttributes().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getOwnedAttributes()
+ .iterator(); it.hasNext();) {
Property childElement = (Property) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == PortEditPart.VISUAL_ID) {
@@ -251,7 +256,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
}
Component modelElement = (Component) view.getElement();
LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for (Iterator<?> it = modelElement.getOwnedAttributes().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getOwnedAttributes()
+ .iterator(); it.hasNext();) {
Property childElement = (Property) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == PortEditPart.VISUAL_ID) {
@@ -271,7 +277,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
}
Component modelElement = (Component) view.getElement();
LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for (Iterator<?> it = modelElement.getOwnedAttributes().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getOwnedAttributes()
+ .iterator(); it.hasNext();) {
Property childElement = (Property) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == PortEditPart.VISUAL_ID) {
@@ -303,7 +310,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
}
Component modelElement = (Component) containerView.getElement();
LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for (Iterator<?> it = modelElement.getPackagedElements().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getPackagedElements()
+ .iterator(); it.hasNext();) {
PackageableElement childElement = (PackageableElement) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == ComponentEditPartCN.VISUAL_ID) {
@@ -311,7 +319,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
continue;
}
}
- for (Iterator<?> it = modelElement.getOwnedAttributes().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getOwnedAttributes()
+ .iterator(); it.hasNext();) {
Property childElement = (Property) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == PropertyPartEditPartCN.VISUAL_ID) {
@@ -335,7 +344,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
}
Model modelElement = (Model) containerView.getElement();
LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for (Iterator<?> it = modelElement.getPackagedElements().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getPackagedElements()
+ .iterator(); it.hasNext();) {
PackageableElement childElement = (PackageableElement) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == RectangleInterfaceEditPartCN.VISUAL_ID) {
@@ -359,7 +369,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
continue;
}
}
- for (Iterator<?> it = modelElement.getOwnedComments().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getOwnedComments()
+ .iterator(); it.hasNext();) {
Comment childElement = (Comment) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == CommentEditPartPCN.VISUAL_ID) {
@@ -367,7 +378,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
continue;
}
}
- for (Iterator<?> it = modelElement.getOwnedRules().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getOwnedRules()
+ .iterator(); it.hasNext();) {
Constraint childElement = (Constraint) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == ConstraintEditPartPCN.VISUAL_ID) {
@@ -391,7 +403,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
}
Package modelElement = (Package) containerView.getElement();
LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for (Iterator<?> it = modelElement.getPackagedElements().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getPackagedElements()
+ .iterator(); it.hasNext();) {
PackageableElement childElement = (PackageableElement) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == RectangleInterfaceEditPartCN.VISUAL_ID) {
@@ -415,7 +428,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
continue;
}
}
- for (Iterator<?> it = modelElement.getOwnedComments().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getOwnedComments()
+ .iterator(); it.hasNext();) {
Comment childElement = (Comment) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == CommentEditPartPCN.VISUAL_ID) {
@@ -423,7 +437,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
continue;
}
}
- for (Iterator<?> it = modelElement.getOwnedRules().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getOwnedRules()
+ .iterator(); it.hasNext();) {
Constraint childElement = (Constraint) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == ConstraintEditPartPCN.VISUAL_ID) {
@@ -447,7 +462,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
}
Model modelElement = (Model) containerView.getElement();
LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for (Iterator<?> it = modelElement.getPackagedElements().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getPackagedElements()
+ .iterator(); it.hasNext();) {
PackageableElement childElement = (PackageableElement) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == RectangleInterfaceEditPartCN.VISUAL_ID) {
@@ -471,7 +487,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
continue;
}
}
- for (Iterator<?> it = modelElement.getOwnedComments().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getOwnedComments()
+ .iterator(); it.hasNext();) {
Comment childElement = (Comment) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == CommentEditPartPCN.VISUAL_ID) {
@@ -479,7 +496,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
continue;
}
}
- for (Iterator<?> it = modelElement.getOwnedRules().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getOwnedRules()
+ .iterator(); it.hasNext();) {
Constraint childElement = (Constraint) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == ConstraintEditPartPCN.VISUAL_ID) {
@@ -503,7 +521,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
}
Package modelElement = (Package) containerView.getElement();
LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for (Iterator<?> it = modelElement.getPackagedElements().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getPackagedElements()
+ .iterator(); it.hasNext();) {
PackageableElement childElement = (PackageableElement) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == RectangleInterfaceEditPartCN.VISUAL_ID) {
@@ -527,7 +546,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
continue;
}
}
- for (Iterator<?> it = modelElement.getOwnedComments().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getOwnedComments()
+ .iterator(); it.hasNext();) {
Comment childElement = (Comment) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == CommentEditPartPCN.VISUAL_ID) {
@@ -535,7 +555,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
continue;
}
}
- for (Iterator<?> it = modelElement.getOwnedRules().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getOwnedRules()
+ .iterator(); it.hasNext();) {
Constraint childElement = (Constraint) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == ConstraintEditPartPCN.VISUAL_ID) {
@@ -559,7 +580,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
}
Component modelElement = (Component) containerView.getElement();
LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for (Iterator<?> it = modelElement.getPackagedElements().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getPackagedElements()
+ .iterator(); it.hasNext();) {
PackageableElement childElement = (PackageableElement) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == ComponentEditPartCN.VISUAL_ID) {
@@ -567,7 +589,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
continue;
}
}
- for (Iterator<?> it = modelElement.getOwnedAttributes().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getOwnedAttributes()
+ .iterator(); it.hasNext();) {
Property childElement = (Property) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == PropertyPartEditPartCN.VISUAL_ID) {
@@ -591,7 +614,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
}
Component modelElement = (Component) containerView.getElement();
LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for (Iterator<?> it = modelElement.getPackagedElements().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getPackagedElements()
+ .iterator(); it.hasNext();) {
PackageableElement childElement = (PackageableElement) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == ComponentEditPartCN.VISUAL_ID) {
@@ -599,7 +623,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
continue;
}
}
- for (Iterator<?> it = modelElement.getOwnedAttributes().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getOwnedAttributes()
+ .iterator(); it.hasNext();) {
Property childElement = (Property) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == PropertyPartEditPartCN.VISUAL_ID) {
@@ -623,7 +648,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
}
Interface modelElement = (Interface) containerView.getElement();
LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for (Iterator<?> it = modelElement.getOwnedAttributes().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getOwnedAttributes()
+ .iterator(); it.hasNext();) {
Property childElement = (Property) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == PropertyForInterfaceEditPart.VISUAL_ID) {
@@ -647,7 +673,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
}
Interface modelElement = (Interface) containerView.getElement();
LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for (Iterator<?> it = modelElement.getOwnedOperations().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getOwnedOperations()
+ .iterator(); it.hasNext();) {
Operation childElement = (Operation) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == OperationForInterfaceEditPart.VISUAL_ID) {
@@ -655,7 +682,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
continue;
}
}
- for (Iterator<?> it = modelElement.getOwnedReceptions().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getOwnedReceptions()
+ .iterator(); it.hasNext();) {
Reception childElement = (Reception) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == ReceptionInInterfaceEditPart.VISUAL_ID) {
@@ -679,7 +707,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
}
Interface modelElement = (Interface) containerView.getElement();
LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for (Iterator<?> it = modelElement.getOwnedAttributes().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getOwnedAttributes()
+ .iterator(); it.hasNext();) {
Property childElement = (Property) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == PropertyForInterfaceEditPart.VISUAL_ID) {
@@ -703,7 +732,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
}
Interface modelElement = (Interface) containerView.getElement();
LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>();
- for (Iterator<?> it = modelElement.getOwnedOperations().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getOwnedOperations()
+ .iterator(); it.hasNext();) {
Operation childElement = (Operation) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == OperationForInterfaceEditPart.VISUAL_ID) {
@@ -711,7 +741,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
continue;
}
}
- for (Iterator<?> it = modelElement.getOwnedReceptions().iterator(); it.hasNext();) {
+ for (Iterator<?> it = modelElement.getOwnedReceptions()
+ .iterator(); it.hasNext();) {
Reception childElement = (Reception) it.next();
int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement);
if (visualID == ReceptionInInterfaceEditPart.VISUAL_ID) {
@@ -952,14 +983,22 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getPackage_1000ContainedLinks(View view) {
Package modelElement = (Package) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -976,8 +1015,10 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getComponent_2002ContainedLinks(View view) {
Component modelElement = (Component) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Connector_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4003
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Connector_4019
+ (modelElement));
return result;
}
@@ -987,14 +1028,22 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getModel_3202ContainedLinks(View view) {
Model modelElement = (Model) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -1004,14 +1053,22 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getPackage_3200ContainedLinks(View view) {
Package modelElement = (Package) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -1021,7 +1078,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getInterface_3205ContainedLinks(View view) {
Interface modelElement = (Interface) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4003
+ (modelElement));
return result;
}
@@ -1031,7 +1089,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getComment_3201ContainedLinks(View view) {
Comment modelElement = (Comment) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement));
+ result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement));
return result;
}
@@ -1041,7 +1100,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getConstraint_3199ContainedLinks(View view) {
Constraint modelElement = (Constraint) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement));
+ result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement));
return result;
}
@@ -1058,7 +1118,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getInterface_2003ContainedLinks(View view) {
Interface modelElement = (Interface) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4003
+ (modelElement));
return result;
}
@@ -1075,14 +1136,22 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getModel_3077ContainedLinks(View view) {
Model modelElement = (Model) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -1092,14 +1161,22 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getPackage_3076ContainedLinks(View view) {
Package modelElement = (Package) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -1109,7 +1186,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getInterface_3078ContainedLinks(View view) {
Interface modelElement = (Interface) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4003
+ (modelElement));
return result;
}
@@ -1119,8 +1197,10 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getComponent_3070ContainedLinks(View view) {
Component modelElement = (Component) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Connector_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4003
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Connector_4019
+ (modelElement));
return result;
}
@@ -1130,8 +1210,10 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getComponent_3071ContainedLinks(View view) {
Component modelElement = (Component) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement));
- result.addAll(getContainedTypeModelFacetLinks_Connector_4019(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4003
+ (modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Connector_4019
+ (modelElement));
return result;
}
@@ -1141,7 +1223,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getComment_3074ContainedLinks(View view) {
Comment modelElement = (Comment) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement));
+ result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement));
return result;
}
@@ -1151,7 +1234,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getConstraint_3075ContainedLinks(View view) {
Constraint modelElement = (Constraint) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement));
+ result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement));
return result;
}
@@ -1182,7 +1266,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getInterface_3072ContainedLinks(View view) {
Interface modelElement = (Interface) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement));
+ result.addAll(getContainedTypeModelFacetLinks_Generalization_4003
+ (modelElement));
return result;
}
@@ -1270,15 +1355,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Dependency modelElement = (Dependency) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1289,16 +1383,26 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Component modelElement = (Component) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1309,15 +1413,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Model modelElement = (Model) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1328,15 +1441,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Package modelElement = (Package) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1347,17 +1469,28 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Interface modelElement = (Interface) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_InterfaceRealization_4006(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1368,8 +1501,10 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Comment modelElement = (Comment) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
return result;
}
@@ -1380,15 +1515,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Constraint modelElement = (Constraint) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1399,15 +1543,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
NamedElement modelElement = (NamedElement) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1418,17 +1571,28 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Interface modelElement = (Interface) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_InterfaceRealization_4006(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1439,15 +1603,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Port modelElement = (Port) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1458,15 +1631,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Model modelElement = (Model) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1477,15 +1659,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Package modelElement = (Package) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1496,17 +1687,28 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Interface modelElement = (Interface) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_InterfaceRealization_4006(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1517,16 +1719,26 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Component modelElement = (Component) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1537,16 +1749,26 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Component modelElement = (Component) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1557,8 +1779,10 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Comment modelElement = (Comment) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
return result;
}
@@ -1569,15 +1793,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Constraint modelElement = (Constraint) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1609,17 +1842,28 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Interface modelElement = (Interface) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_InterfaceRealization_4006(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1630,15 +1874,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Property modelElement = (Property) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1649,15 +1902,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Usage modelElement = (Usage) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1668,15 +1930,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
InterfaceRealization modelElement = (InterfaceRealization) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1687,8 +1958,10 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Generalization modelElement = (Generalization) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
return result;
}
@@ -1699,15 +1972,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Substitution modelElement = (Substitution) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1718,15 +2000,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Manifestation modelElement = (Manifestation) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1737,15 +2028,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
ComponentRealization modelElement = (ComponentRealization) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1756,15 +2056,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Abstraction modelElement = (Abstraction) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1775,15 +2084,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Dependency modelElement = (Dependency) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1794,15 +2112,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Dependency modelElement = (Dependency) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1813,15 +2140,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
Connector modelElement = (Connector) view.getElement();
CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet());
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getIncomingTypeModelFacetLinks_Usage_4001(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement, crossReferencer));
- result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer));
- result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017(modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Usage_4001
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Substitution_4012
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4014
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Abstraction_4013
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010
+ (modelElement, crossReferencer));
+ result.addAll(getIncomingTypeModelFacetLinks_Dependency_4017
+ (modelElement, crossReferencer));
return result;
}
@@ -1831,14 +2167,22 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getDependency_3203OutgoingLinks(View view) {
Dependency modelElement = (Dependency) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -1848,15 +2192,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getComponent_2002OutgoingLinks(View view) {
Component modelElement = (Component) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -1866,14 +2219,22 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getModel_3202OutgoingLinks(View view) {
Model modelElement = (Model) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -1883,14 +2244,22 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getPackage_3200OutgoingLinks(View view) {
Package modelElement = (Package) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -1900,15 +2269,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getInterface_3205OutgoingLinks(View view) {
Interface modelElement = (Interface) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -1918,7 +2296,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getComment_3201OutgoingLinks(View view) {
Comment modelElement = (Comment) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement));
+ result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement));
return result;
}
@@ -1928,15 +2307,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getConstraint_3199OutgoingLinks(View view) {
Constraint modelElement = (Constraint) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -1946,14 +2334,22 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getNamedElement_3204OutgoingLinks(View view) {
NamedElement modelElement = (NamedElement) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -1963,15 +2359,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getInterface_2003OutgoingLinks(View view) {
Interface modelElement = (Interface) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -1981,14 +2386,22 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getPort_3069OutgoingLinks(View view) {
Port modelElement = (Port) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -1998,14 +2411,22 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getModel_3077OutgoingLinks(View view) {
Model modelElement = (Model) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -2015,14 +2436,22 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getPackage_3076OutgoingLinks(View view) {
Package modelElement = (Package) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -2032,15 +2461,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getInterface_3078OutgoingLinks(View view) {
Interface modelElement = (Interface) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -2050,15 +2488,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getComponent_3070OutgoingLinks(View view) {
Component modelElement = (Component) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -2068,15 +2515,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getComponent_3071OutgoingLinks(View view) {
Component modelElement = (Component) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -2086,7 +2542,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getComment_3074OutgoingLinks(View view) {
Comment modelElement = (Comment) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(modelElement));
+ result.addAll(getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4015
+ (modelElement));
return result;
}
@@ -2096,15 +2553,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getConstraint_3075OutgoingLinks(View view) {
Constraint modelElement = (Constraint) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -2135,15 +2601,24 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getInterface_3072OutgoingLinks(View view) {
Interface modelElement = (Interface) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -2153,14 +2628,22 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getProperty_3079OutgoingLinks(View view) {
Property modelElement = (Property) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -2170,14 +2653,22 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getUsage_4001OutgoingLinks(View view) {
Usage modelElement = (Usage) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -2187,14 +2678,22 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getInterfaceRealization_4006OutgoingLinks(View view) {
InterfaceRealization modelElement = (InterfaceRealization) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -2211,14 +2710,22 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getSubstitution_4012OutgoingLinks(View view) {
Substitution modelElement = (Substitution) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -2228,14 +2735,22 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getManifestation_4014OutgoingLinks(View view) {
Manifestation modelElement = (Manifestation) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -2245,14 +2760,22 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getComponentRealization_4007OutgoingLinks(View view) {
ComponentRealization modelElement = (ComponentRealization) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -2262,14 +2785,22 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getAbstraction_4013OutgoingLinks(View view) {
Abstraction modelElement = (Abstraction) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -2279,14 +2810,22 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getDependency_4010OutgoingLinks(View view) {
Dependency modelElement = (Dependency) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -2296,14 +2835,22 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getDependency_4017OutgoingLinks(View view) {
Dependency modelElement = (Dependency) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -2313,14 +2860,22 @@ public class UMLDiagramUpdater implements DiagramUpdater {
public List<UMLLinkDescriptor> getConnector_4019OutgoingLinks(View view) {
Connector modelElement = (Connector) view.getElement();
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement));
- result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017(modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Usage_4001
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_InterfaceRealization_4006
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Substitution_4012
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4014
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_ComponentRealization_4007
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Abstraction_4013
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010
+ (modelElement));
+ result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4017
+ (modelElement));
return result;
}
@@ -2329,7 +2884,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
*/
protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Usage_4001(Package container) {
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) {
+ for (Iterator<?> links = container.getPackagedElements()
+ .iterator(); links.hasNext();) {
EObject linkObject = (EObject) links.next();
if (false == linkObject instanceof Usage) {
continue;
@@ -2360,7 +2916,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
*/
protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_InterfaceRealization_4006(Package container) {
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) {
+ for (Iterator<?> links = container.getPackagedElements()
+ .iterator(); links.hasNext();) {
EObject linkObject = (EObject) links.next();
if (false == linkObject instanceof InterfaceRealization) {
continue;
@@ -2386,7 +2943,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
*/
protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Generalization_4003(Classifier container) {
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getGeneralizations().iterator(); links.hasNext();) {
+ for (Iterator<?> links = container.getGeneralizations()
+ .iterator(); links.hasNext();) {
EObject linkObject = (EObject) links.next();
if (false == linkObject instanceof Generalization) {
continue;
@@ -2407,7 +2965,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
*/
protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Substitution_4012(Package container) {
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) {
+ for (Iterator<?> links = container.getPackagedElements()
+ .iterator(); links.hasNext();) {
EObject linkObject = (EObject) links.next();
if (false == linkObject instanceof Substitution) {
continue;
@@ -2438,7 +2997,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
*/
protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Manifestation_4014(Package container) {
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) {
+ for (Iterator<?> links = container.getPackagedElements()
+ .iterator(); links.hasNext();) {
EObject linkObject = (EObject) links.next();
if (false == linkObject instanceof Manifestation) {
continue;
@@ -2469,7 +3029,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
*/
protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_ComponentRealization_4007(Package container) {
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) {
+ for (Iterator<?> links = container.getPackagedElements()
+ .iterator(); links.hasNext();) {
EObject linkObject = (EObject) links.next();
if (false == linkObject instanceof ComponentRealization) {
continue;
@@ -2500,7 +3061,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
*/
protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Abstraction_4013(Package container) {
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) {
+ for (Iterator<?> links = container.getPackagedElements()
+ .iterator(); links.hasNext();) {
EObject linkObject = (EObject) links.next();
if (false == linkObject instanceof Abstraction) {
continue;
@@ -2531,7 +3093,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
*/
protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Dependency_4010(Package container) {
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) {
+ for (Iterator<?> links = container.getPackagedElements()
+ .iterator(); links.hasNext();) {
EObject linkObject = (EObject) links.next();
if (false == linkObject instanceof Dependency) {
continue;
@@ -2562,7 +3125,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
*/
protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Dependency_4017(Package container) {
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) {
+ for (Iterator<?> links = container.getPackagedElements()
+ .iterator(); links.hasNext();) {
EObject linkObject = (EObject) links.next();
if (false == linkObject instanceof Dependency) {
continue;
@@ -2593,7 +3157,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
*/
protected Collection<UMLLinkDescriptor> getContainedTypeModelFacetLinks_Connector_4019(StructuredClassifier container) {
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getOwnedConnectors().iterator(); links.hasNext();) {
+ for (Iterator<?> links = container.getOwnedConnectors()
+ .iterator(); links.hasNext();) {
EObject linkObject = (EObject) links.next();
if (false == linkObject instanceof Connector) {
continue;
@@ -2884,7 +3449,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
return Collections.emptyList();
}
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) {
+ for (Iterator<?> links = container.getPackagedElements()
+ .iterator(); links.hasNext();) {
EObject linkObject = (EObject) links.next();
if (false == linkObject instanceof Usage) {
continue;
@@ -2930,7 +3496,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
return Collections.emptyList();
}
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) {
+ for (Iterator<?> links = container.getPackagedElements()
+ .iterator(); links.hasNext();) {
EObject linkObject = (EObject) links.next();
if (false == linkObject instanceof InterfaceRealization) {
continue;
@@ -2971,7 +3538,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
return Collections.emptyList();
}
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getGeneralizations().iterator(); links.hasNext();) {
+ for (Iterator<?> links = container.getGeneralizations()
+ .iterator(); links.hasNext();) {
EObject linkObject = (EObject) links.next();
if (false == linkObject instanceof Generalization) {
continue;
@@ -3007,7 +3575,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
return Collections.emptyList();
}
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) {
+ for (Iterator<?> links = container.getPackagedElements()
+ .iterator(); links.hasNext();) {
EObject linkObject = (EObject) links.next();
if (false == linkObject instanceof Substitution) {
continue;
@@ -3053,7 +3622,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
return Collections.emptyList();
}
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) {
+ for (Iterator<?> links = container.getPackagedElements()
+ .iterator(); links.hasNext();) {
EObject linkObject = (EObject) links.next();
if (false == linkObject instanceof Manifestation) {
continue;
@@ -3099,7 +3669,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
return Collections.emptyList();
}
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) {
+ for (Iterator<?> links = container.getPackagedElements()
+ .iterator(); links.hasNext();) {
EObject linkObject = (EObject) links.next();
if (false == linkObject instanceof ComponentRealization) {
continue;
@@ -3145,7 +3716,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
return Collections.emptyList();
}
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) {
+ for (Iterator<?> links = container.getPackagedElements()
+ .iterator(); links.hasNext();) {
EObject linkObject = (EObject) links.next();
if (false == linkObject instanceof Abstraction) {
continue;
@@ -3179,7 +3751,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
*/
protected Collection<UMLLinkDescriptor> getOutgoingFeatureModelFacetLinks_Comment_AnnotatedElement_4015(Comment source) {
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> destinations = source.getAnnotatedElements().iterator(); destinations.hasNext();) {
+ for (Iterator<?> destinations = source.getAnnotatedElements()
+ .iterator(); destinations.hasNext();) {
Element destination = (Element) destinations.next();
result.add(new UMLLinkDescriptor(source, destination, UMLElementTypes.CommentAnnotatedElement_4015, CommentAnnotatedElementEditPart.VISUAL_ID));
}
@@ -3191,7 +3764,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
*/
protected Collection<UMLLinkDescriptor> getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(Constraint source) {
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> destinations = source.getConstrainedElements().iterator(); destinations.hasNext();) {
+ 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));
}
@@ -3215,7 +3789,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
return Collections.emptyList();
}
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) {
+ for (Iterator<?> links = container.getPackagedElements()
+ .iterator(); links.hasNext();) {
EObject linkObject = (EObject) links.next();
if (false == linkObject instanceof Dependency) {
continue;
@@ -3261,7 +3836,8 @@ public class UMLDiagramUpdater implements DiagramUpdater {
return Collections.emptyList();
}
LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>();
- for (Iterator<?> links = container.getPackagedElements().iterator(); links.hasNext();) {
+ for (Iterator<?> links = container.getPackagedElements()
+ .iterator(); links.hasNext();) {
EObject linkObject = (EObject) links.next();
if (false == linkObject instanceof Dependency) {
continue;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDocumentProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDocumentProvider.java
index 033789fd35f..c6bae969739 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDocumentProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDocumentProvider.java
@@ -77,11 +77,14 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi
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$
+ 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;
@@ -95,7 +98,9 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi
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$
+ 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();
@@ -184,7 +189,9 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi
public void setTarget(Notifier newTarget) {
myTarger = newTarget;
}
+
});
+
return editingDomain;
}
@@ -240,13 +247,16 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi
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));
+ 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$
+ 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));
}
}
@@ -315,6 +325,7 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi
}
ResourcesPlugin.getWorkspace().validateEdit(files2Validate.toArray(new IFile[files2Validate.size()]), computationContext);
}
+
super.doValidateState(element, computationContext);
}
@@ -495,6 +506,7 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi
if (toCreateOrModify.exists()) {
return ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(toCreateOrModify);
}
+
IResource parent = toCreateOrModify;
do {
/*
@@ -506,6 +518,7 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi
toCreateOrModify = parent;
parent = toCreateOrModify.getParent();
} while (parent != null && !parent.exists());
+
return ResourcesPlugin.getWorkspace().getRuleFactory().createRule(toCreateOrModify);
}
@@ -533,15 +546,20 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi
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));
+ 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"
+ 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()));
+ monitor.setTaskName(NLS.bind(
+ Messages.UMLDocumentProvider_SaveNextResourceTask,
+ nextResource.getURI()));
if (nextResource.isLoaded() && !info.getEditingDomain().isReadOnly(nextResource)) {
try {
nextResource.save(UMLDiagramEditorUtil.getSaveOptions());
@@ -571,20 +589,22 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi
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$
+ 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$
+ 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);
@@ -617,6 +637,7 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi
}
}
changedResource.unload();
+
fireElementContentAboutToBeReplaced(info.getEditorInput());
removeUnchangedElementListeners(info.getEditorInput(), info);
info.fStatus = null;
@@ -892,7 +913,6 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi
}
}
Display.getDefault().asyncExec(new Runnable() {
-
@Override
public void run() {
handleElementChanged(ResourceSetInfo.this, resource, null);
@@ -913,7 +933,6 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi
}
}
Display.getDefault().asyncExec(new Runnable() {
-
@Override
public void run() {
fireElementDeleted(ResourceSetInfo.this.getEditorInput());
@@ -935,7 +954,6 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi
}
if (myDocument.getDiagram().eResource() == resource) {
Display.getDefault().asyncExec(new Runnable() {
-
@Override
public void run() {
handleElementMoved(ResourceSetInfo.this.getEditorInput(), newURI);
@@ -1003,6 +1021,7 @@ public class UMLDocumentProvider extends AbstractDocumentProvider implements IDi
}
if (dirtyStateChanged) {
fireElementDirtyStateChanged(myInfo.getEditorInput(), modified);
+
if (!modified) {
myInfo.setModificationStamp(computeModificationStamp(myInfo));
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLInitDiagramFileAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLInitDiagramFileAction.java
index 493082ebd23..05f1d846266 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLInitDiagramFileAction.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLInitDiagramFileAction.java
@@ -63,7 +63,8 @@ public class UMLInitDiagramFileAction implements IObjectActionDelegate {
if (selection instanceof IStructuredSelection == false || selection.isEmpty()) {
return;
}
- IFile file = (IFile) ((IStructuredSelection) selection).getFirstElement();
+ IFile file =
+ (IFile) ((IStructuredSelection) selection).getFirstElement();
domainModelURI = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
action.setEnabled(true);
}
@@ -80,21 +81,27 @@ public class UMLInitDiagramFileAction implements IObjectActionDelegate {
*/
@Override
public void run(IAction action) {
- TransactionalEditingDomain editingDomain = WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain();
+ 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$
+ UMLDiagramEditorPlugin.getInstance().logError(
+ "Unable to load resource: " + domainModelURI, ex); //$NON-NLS-1$
}
if (diagramRoot == null) {
- MessageDialog.openError(getShell(), Messages.InitDiagramFile_ResourceErrorDialogTitle, Messages.InitDiagramFile_ResourceErrorDialogMessage);
+ MessageDialog.openError(getShell(),
+ Messages.InitDiagramFile_ResourceErrorDialogTitle,
+ Messages.InitDiagramFile_ResourceErrorDialogMessage);
return;
}
Wizard wizard = new UMLNewDiagramFileWizard(domainModelURI, diagramRoot, editingDomain);
- wizard.setWindowTitle(NLS.bind(Messages.InitDiagramFile_WizardTitle, ComponentDiagramEditPart.MODEL_ID));
+ wizard.setWindowTitle(NLS.bind(
+ Messages.InitDiagramFile_WizardTitle,
+ ComponentDiagramEditPart.MODEL_ID));
UMLDiagramEditorUtil.runWizard(getShell(), wizard, "InitDiagramFile"); //$NON-NLS-1$
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLMatchingStrategy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLMatchingStrategy.java
index a50c30d57ec..ee6b60d3f4a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLMatchingStrategy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLMatchingStrategy.java
@@ -33,6 +33,7 @@ public class UMLMatchingStrategy implements IEditorMatchingStrategy {
} catch (PartInitException e) {
return false;
}
+
if (editorInput.equals(input)) {
return true;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLNewDiagramFileWizard.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLNewDiagramFileWizard.java
index 19f8e4ed473..2590c4f18dc 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLNewDiagramFileWizard.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLNewDiagramFileWizard.java
@@ -67,9 +67,13 @@ public class UMLNewDiagramFileWizard extends Wizard {
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 = new WizardNewFileCreationPage
+ (Messages.UMLNewDiagramFileWizard_CreationPageName, StructuredSelection.EMPTY);
myFileCreationPage.setTitle(Messages.UMLNewDiagramFileWizard_CreationPageTitle);
- myFileCreationPage.setDescription(NLS.bind(Messages.UMLNewDiagramFileWizard_CreationPageDescription, ComponentDiagramEditPart.MODEL_ID));
+ myFileCreationPage.setDescription(NLS.bind(
+ Messages.UMLNewDiagramFileWizard_CreationPageDescription,
+ ComponentDiagramEditPart.MODEL_ID));
IPath filePath;
String fileName = URI.decode(domainModelURI.trimFileExtension().lastSegment());
if (domainModelURI.isPlatformResource()) {
@@ -81,11 +85,14 @@ public class UMLNewDiagramFileWizard extends Wizard {
throw new IllegalArgumentException("Unsupported URI: " + domainModelURI); //$NON-NLS-1$
}
myFileCreationPage.setContainerFullPath(filePath);
- myFileCreationPage.setFileName(UMLDiagramEditorUtil.getUniqueFileName(filePath, fileName, "PapyrusUMLComponent_diagram")); //$NON-NLS-1$
+ myFileCreationPage.setFileName(UMLDiagramEditorUtil.getUniqueFileName(
+ filePath, fileName, "PapyrusUMLComponent_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;
}
@@ -110,27 +117,37 @@ public class UMLNewDiagramFileWizard extends Wizard {
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 != ComponentDiagramEditPart.VISUAL_ID) {
- return CommandResult.newErrorCommandResult(Messages.UMLNewDiagramFileWizard_IncorrectRootError);
- }
- Diagram diagram = ViewService.createDiagram(diagramRootElementSelectionPage.getModelElement(), ComponentDiagramEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
- diagramResource.getContents().add(diagram);
- return CommandResult.newOKCommandResult();
- }
- };
+ 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 != ComponentDiagramEditPart.VISUAL_ID) {
+ return CommandResult.newErrorCommandResult(
+ Messages.UMLNewDiagramFileWizard_IncorrectRootError);
+ }
+ Diagram diagram =
+ ViewService.createDiagram(
+ diagramRootElementSelectionPage.getModelElement(), ComponentDiagramEditPart.MODEL_ID,
+ UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+ diagramResource.getContents().add(diagram);
+ return CommandResult.newOKCommandResult();
+ }
+ };
try {
- OperationHistoryFactory.getOperationHistory().execute(command, new NullProgressMonitor(), null);
+ 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$
+ 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$
}
@@ -166,7 +183,10 @@ public class UMLNewDiagramFileWizard extends Wizard {
setErrorMessage(Messages.UMLNewDiagramFileWizard_RootSelectionPageNoSelectionMessage);
return false;
}
- boolean result = ViewService.getInstance().provides(new CreateDiagramViewOperation(new EObjectAdapter(getModelElement()), ComponentDiagramEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT));
+ boolean result = ViewService.getInstance().provides(
+ new CreateDiagramViewOperation(
+ new EObjectAdapter(getModelElement()),
+ ComponentDiagramEditPart.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.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLPaletteFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLPaletteFactory.java
index 73ad8af0c69..11437a0a4f5 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLPaletteFactory.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLPaletteFactory.java
@@ -138,6 +138,7 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter {
* @generated
*/
public UMLPaletteFactory() {
+
}
/**
@@ -217,6 +218,7 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter {
*/
@Override
public Object getTemplate(String templateId) {
+
// default return: null
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLVisualIDRegistry.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLVisualIDRegistry.java
index 06b11434d8b..fa49b0d7298 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLVisualIDRegistry.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLVisualIDRegistry.java
@@ -841,7 +841,7 @@ public class UMLVisualIDRegistry {
*/
public static boolean checkNodeVisualID(View containerView, EObject domainElement, int candidate) {
if (candidate == -1) {
- // unrecognized id is always bad
+ //unrecognized id is always bad
return false;
}
int basic = getNodeVisualID(containerView, domainElement);
@@ -901,7 +901,6 @@ public class UMLVisualIDRegistry {
* @generated
*/
public static final DiagramStructure TYPED_INSTANCE = new DiagramStructure() {
-
/**
* @generated
*/
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/ValidateAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/ValidateAction.java
index 8a1597603e7..2a55fbf3cda 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/ValidateAction.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/ValidateAction.java
@@ -77,13 +77,16 @@ public class ValidateAction extends Action {
if (workbenchPart instanceof IDiagramWorkbenchPart) {
final IDiagramWorkbenchPart part = (IDiagramWorkbenchPart) workbenchPart;
try {
- new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() {
+ new WorkspaceModifyDelegatingOperation(
+ new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- runValidation(part.getDiagramEditPart(), part.getDiagram());
- }
- }).run(new NullProgressMonitor());
+ @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$
}
@@ -96,9 +99,11 @@ public class ValidateAction extends Action {
public static void runValidation(View view) {
try {
if (UMLDiagramEditorUtil.openDiagram(view.eResource())) {
- IEditorPart editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ IEditorPart editorPart = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if (editorPart instanceof IDiagramWorkbenchPart) {
- runValidation(((IDiagramWorkbenchPart) editorPart).getDiagramEditPart(), view);
+ runValidation(((IDiagramWorkbenchPart) editorPart).
+ getDiagramEditPart(), view);
} else {
runNonUIValidation(view);
}
@@ -116,7 +121,10 @@ public class ValidateAction extends Action {
if (shell == null) {
shell = new Shell();
}
- DiagramEditPart diagramEditPart = OffscreenEditPartFactory.getInstance().createDiagramEditPart(view.getDiagram(), shell);
+
+ DiagramEditPart diagramEditPart =
+ OffscreenEditPartFactory.getInstance().createDiagramEditPart(
+ view.getDiagram(), shell);
runValidation(diagramEditPart, view);
}
@@ -156,13 +164,17 @@ public class ValidateAction extends Action {
* @generated
*/
private static void validate(DiagramEditPart diagramEditPart, View view) {
- IFile target = view.eResource() != null ? WorkspaceSynchronizer.getFile(view.eResource()) : null;
+ 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);
+ IBatchValidator validator =
+ (IBatchValidator)
+ ModelValidationService.getInstance().newValidator(
+ EvaluationMode.BATCH);
validator.setIncludeLiveConstraints(true);
if (view.isSetElement() && view.getElement() != null) {
IStatus status = validator.validate(view.getElement());
@@ -173,37 +185,51 @@ public class ValidateAction extends Action {
/**
* @generated
*/
- private static void createMarkers(IFile target, IStatus validationStatus, DiagramEditPart diagramEditPart) {
+ 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));
+ 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());
+ 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) {
+ 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));
+ 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()));
+ View view = UMLDiagramEditorUtil.findView(
+ diagramEditPart, element, element2ViewMap);
+ addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view),
+ EMFCoreUtil.getQualifiedName(element, true),
+ nextDiagnostic.getMessage(), diagnosticToStatusSeverity(nextDiagnostic.getSeverity()));
}
}
}
@@ -211,11 +237,13 @@ public class ValidateAction extends Action {
/**
* @generated
*/
- private static void addMarker(EditPartViewer viewer, IFile target, String elementId, String location, String message, int statusSeverity) {
+ 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);
+ UMLMarkerNavigationProvider.addMarker(
+ target, elementId, location, message, statusSeverity);
}
/**
@@ -228,7 +256,8 @@ public class ValidateAction extends Action {
return IStatus.INFO;
} else if (diagnosticSeverity == Diagnostic.WARNING) {
return IStatus.WARNING;
- } else if (diagnosticSeverity == Diagnostic.ERROR || diagnosticSeverity == Diagnostic.CANCEL) {
+ } else if (diagnosticSeverity == Diagnostic.ERROR
+ || diagnosticSeverity == Diagnostic.CANCEL) {
return IStatus.ERROR;
}
return IStatus.INFO;
@@ -264,7 +293,8 @@ public class ValidateAction extends Action {
}
if (diagnostic.getChildren() != null && !diagnostic.getChildren().isEmpty()) {
for (Iterator<Diagnostic> it = diagnostic.getChildren().iterator(); it.hasNext();) {
- collectTargetElements(it.next(), targetElementCollector, allDiagnostics);
+ collectTargetElements(it.next(),
+ targetElementCollector, allDiagnostics);
}
}
return targetElementCollector;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/preferences/DiagramPreferenceInitializer.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/preferences/DiagramPreferenceInitializer.java
index e1b22bfe49e..a220ebbd999 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/preferences/DiagramPreferenceInitializer.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/preferences/DiagramPreferenceInitializer.java
@@ -36,6 +36,7 @@ public class DiagramPreferenceInitializer extends AbstractPreferenceInitializer
ConnectionsPreferencePage.initDefaults(store);
PrintingPreferencePage.initDefaults(store);
RulerGridPreferencePage.initDefaults(store);
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/ElementInitializers.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/ElementInitializers.java
index a8ed089aa1b..a677a044229 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/ElementInitializers.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/ElementInitializers.java
@@ -1,631 +1,695 @@
-/**
- * Copyright (c) 2014 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.component.providers;
-
-import org.eclipse.papyrus.uml.diagram.component.expressions.UMLOCLFactory;
-import org.eclipse.papyrus.uml.diagram.component.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil;
-import org.eclipse.uml2.uml.Abstraction;
-import org.eclipse.uml2.uml.AggregationKind;
-import org.eclipse.uml2.uml.Comment;
-import org.eclipse.uml2.uml.Component;
-import org.eclipse.uml2.uml.ComponentRealization;
-import org.eclipse.uml2.uml.Connector;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.Dependency;
-import org.eclipse.uml2.uml.Interface;
-import org.eclipse.uml2.uml.InterfaceRealization;
-import org.eclipse.uml2.uml.LiteralString;
-import org.eclipse.uml2.uml.Manifestation;
-import org.eclipse.uml2.uml.Model;
-import org.eclipse.uml2.uml.Operation;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.Port;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.Reception;
-import org.eclipse.uml2.uml.Substitution;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.Usage;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-/**
- * @generated
- */
-public class ElementInitializers {
-
- protected ElementInitializers() {
- // use #getInstance to access cached instance
- }
-
- /**
- * @generated
- */
- public void init_Component_2002(Component instance) {
- try {
- Object value_0 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getComponent(), null).evaluate(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_3202(Model instance) {
- try {
- Object value_0 = name_Model_3202(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_3200(Package instance) {
- try {
- Object value_0 = UMLOCLFactory.getExpression(5, UMLPackage.eINSTANCE.getPackage(), null).evaluate(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_Interface_3205(Interface instance) {
- try {
- Object value_0 = name_Interface_3205(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_Comment_3201(Comment instance) {
- try {
- Object value_0 = body_Comment_3201(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_3199(Constraint instance) {
- try {
- Object value_0 = name_Constraint_3199(instance);
- if (value_0 != null) {
- instance.setName((String) value_0);
- }
- Object value_1 = specification_Constraint_3199(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_Interface_2003(Interface instance) {
- try {
- Object value_0 = UMLOCLFactory.getExpression(2, UMLPackage.eINSTANCE.getInterface(), null).evaluate(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_Port_3069(Port instance) {
- try {
- Object value_0 = UMLOCLFactory.getExpression(1, UMLPackage.eINSTANCE.getPort(), null).evaluate(instance);
- if (value_0 != null) {
- instance.setName((String) value_0);
- }
- instance.setAggregation(AggregationKind.COMPOSITE_LITERAL);
-
- } catch (RuntimeException e) {
- UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
- }
- }
-
- /**
- * @generated
- */
- public void init_Model_3077(Model instance) {
- try {
- Object value_0 = name_Model_3077(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_3076(Package instance) {
- try {
- Object value_0 = UMLOCLFactory.getExpression(5, UMLPackage.eINSTANCE.getPackage(), null).evaluate(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_Interface_3078(Interface instance) {
- try {
- Object value_0 = name_Interface_3078(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_Component_3070(Component instance) {
- try {
- Object value_0 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getComponent(), null).evaluate(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_Component_3071(Component instance) {
- try {
- Object value_0 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getComponent(), null).evaluate(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_Comment_3074(Comment instance) {
- try {
- Object value_0 = body_Comment_3074(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_3075(Constraint instance) {
- try {
- Object value_0 = name_Constraint_3075(instance);
- if (value_0 != null) {
- instance.setName((String) value_0);
- }
- Object value_1 = specification_Constraint_3075(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_Property_1(Property instance) {
- try {
- Object value_0 = name_Property_1(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_Operation_5(Operation instance) {
- try {
- Object value_0 = name_Operation_5(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_Reception_6(Reception instance) {
- try {
- Object value_0 = name_Reception_6(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_Interface_3072(Interface instance) {
- try {
- Object value_0 = UMLOCLFactory.getExpression(2, UMLPackage.eINSTANCE.getInterface(), null).evaluate(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_Property_3079(Property instance) {
- try {
- Object value_0 = name_Property_3079(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_Usage_4001(Usage instance) {
- try {
- Object value_0 = UMLOCLFactory.getExpression(3, UMLPackage.eINSTANCE.getUsage(), null).evaluate(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_InterfaceRealization_4006(InterfaceRealization instance) {
- try {
- Object value_0 = UMLOCLFactory.getExpression(4, UMLPackage.eINSTANCE.getInterfaceRealization(), null).evaluate(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_Substitution_4012(Substitution instance) {
- try {
- Object value_0 = name_Substitution_4012(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_4014(Manifestation instance) {
- try {
- Object value_0 = name_Manifestation_4014(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_ComponentRealization_4007(ComponentRealization instance) {
- try {
- Object value_0 = name_ComponentRealization_4007(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_Abstraction_4013(Abstraction instance) {
- try {
- Object value_0 = name_Abstraction_4013(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
- */
- public void init_Dependency_4017(Dependency instance) {
- try {
- Object value_0 = name_Dependency_4017(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_Connector_4019(Connector instance) {
- try {
- Object value_0 = name_Connector_4019(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_3202(Model it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Interface_3205(Interface it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String body_Comment_3201(Comment it) {
- // Comment body init
- return "";
- }
-
- /**
- * @generated
- */
- private String name_Constraint_3199(Constraint it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private ValueSpecification specification_Constraint_3199(Constraint it) {
- // Constraint specification init
- LiteralString value = UMLFactory.eINSTANCE.createLiteralString();
- value.setValue("");
- return value;
- }
-
- /**
- * @generated
- */
- private String name_Model_3077(Model it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Interface_3078(Interface it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String body_Comment_3074(Comment it) {
- // Comment body init
- return "";
- }
-
- /**
- * @generated
- */
- private String name_Constraint_3075(Constraint it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private ValueSpecification specification_Constraint_3075(Constraint it) {
- // Constraint specification init
- LiteralString value = UMLFactory.eINSTANCE.createLiteralString();
- value.setValue("");
- return value;
- }
-
- /**
- * @generated
- */
- private String name_Property_1(Property it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Operation_5(Operation it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Reception_6(Reception it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Property_3079(Property it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Substitution_4012(Substitution it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Manifestation_4014(Manifestation it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_ComponentRealization_4007(ComponentRealization it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Abstraction_4013(Abstraction it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Dependency_4010(Dependency it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Dependency_4017(Dependency it) {
- return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
- }
-
- /**
- * @generated
- */
- private String name_Connector_4019(Connector 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.component.providers;
+
+import org.eclipse.papyrus.uml.diagram.component.expressions.UMLOCLFactory;
+import org.eclipse.papyrus.uml.diagram.component.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil;
+import org.eclipse.uml2.uml.Abstraction;
+import org.eclipse.uml2.uml.AggregationKind;
+import org.eclipse.uml2.uml.Comment;
+import org.eclipse.uml2.uml.Component;
+import org.eclipse.uml2.uml.ComponentRealization;
+import org.eclipse.uml2.uml.Connector;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.Dependency;
+import org.eclipse.uml2.uml.Interface;
+import org.eclipse.uml2.uml.InterfaceRealization;
+import org.eclipse.uml2.uml.LiteralString;
+import org.eclipse.uml2.uml.Manifestation;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Port;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Reception;
+import org.eclipse.uml2.uml.Substitution;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.Usage;
+import org.eclipse.uml2.uml.ValueSpecification;
+
+/**
+ * @generated
+ */
+public class ElementInitializers {
+
+ protected ElementInitializers() {
+ // use #getInstance to access cached instance
+ }
+
+ /**
+ * @generated
+ */
+ public void init_Component_2002(Component instance) {
+ try {
+ Object value_0 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getComponent(), null).evaluate(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_3202(Model instance) {
+ try {
+ Object value_0 = name_Model_3202(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_3200(Package instance) {
+ try {
+ Object value_0 = UMLOCLFactory.getExpression(5, UMLPackage.eINSTANCE.getPackage(), null).evaluate(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_Interface_3205(Interface instance) {
+ try {
+ Object value_0 = name_Interface_3205(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_Comment_3201(Comment instance) {
+ try {
+ Object value_0 = body_Comment_3201(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_3199(Constraint instance) {
+ try {
+ Object value_0 = name_Constraint_3199(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0
+ );
+ }
+ Object value_1 = specification_Constraint_3199(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_Interface_2003(Interface instance) {
+ try {
+ Object value_0 = UMLOCLFactory.getExpression(2, UMLPackage.eINSTANCE.getInterface(), null).evaluate(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_Port_3069(Port instance) {
+ try {
+ Object value_0 = UMLOCLFactory.getExpression(1, UMLPackage.eINSTANCE.getPort(), null).evaluate(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0
+ );
+ }
+ instance.setAggregation(
+ AggregationKind.COMPOSITE_LITERAL
+ );
+
+ } catch (RuntimeException e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void init_Model_3077(Model instance) {
+ try {
+ Object value_0 = name_Model_3077(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_3076(Package instance) {
+ try {
+ Object value_0 = UMLOCLFactory.getExpression(5, UMLPackage.eINSTANCE.getPackage(), null).evaluate(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_Interface_3078(Interface instance) {
+ try {
+ Object value_0 = name_Interface_3078(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_Component_3070(Component instance) {
+ try {
+ Object value_0 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getComponent(), null).evaluate(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_Component_3071(Component instance) {
+ try {
+ Object value_0 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getComponent(), null).evaluate(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_Comment_3074(Comment instance) {
+ try {
+ Object value_0 = body_Comment_3074(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_3075(Constraint instance) {
+ try {
+ Object value_0 = name_Constraint_3075(instance);
+ if (value_0 != null) {
+ instance.setName(
+ (String) value_0
+ );
+ }
+ Object value_1 = specification_Constraint_3075(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_Property_1(Property instance) {
+ try {
+ Object value_0 = name_Property_1(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_Operation_5(Operation instance) {
+ try {
+ Object value_0 = name_Operation_5(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_Reception_6(Reception instance) {
+ try {
+ Object value_0 = name_Reception_6(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_Interface_3072(Interface instance) {
+ try {
+ Object value_0 = UMLOCLFactory.getExpression(2, UMLPackage.eINSTANCE.getInterface(), null).evaluate(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_Property_3079(Property instance) {
+ try {
+ Object value_0 = name_Property_3079(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_Usage_4001(Usage instance) {
+ try {
+ Object value_0 = UMLOCLFactory.getExpression(3, UMLPackage.eINSTANCE.getUsage(), null).evaluate(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_InterfaceRealization_4006(InterfaceRealization instance) {
+ try {
+ Object value_0 = UMLOCLFactory.getExpression(4, UMLPackage.eINSTANCE.getInterfaceRealization(), null).evaluate(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_Substitution_4012(Substitution instance) {
+ try {
+ Object value_0 = name_Substitution_4012(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_4014(Manifestation instance) {
+ try {
+ Object value_0 = name_Manifestation_4014(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_ComponentRealization_4007(ComponentRealization instance) {
+ try {
+ Object value_0 = name_ComponentRealization_4007(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_Abstraction_4013(Abstraction instance) {
+ try {
+ Object value_0 = name_Abstraction_4013(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
+ */
+ public void init_Dependency_4017(Dependency instance) {
+ try {
+ Object value_0 = name_Dependency_4017(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_Connector_4019(Connector instance) {
+ try {
+ Object value_0 = name_Connector_4019(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_3202(Model it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Interface_3205(Interface it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String body_Comment_3201(Comment it) {
+ // Comment body init
+ return "";
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Constraint_3199(Constraint it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private ValueSpecification specification_Constraint_3199(Constraint it) {
+ // Constraint specification init
+ LiteralString value = UMLFactory.eINSTANCE.createLiteralString();
+ value.setValue("");
+ return value;
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Model_3077(Model it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Interface_3078(Interface it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String body_Comment_3074(Comment it) {
+ // Comment body init
+ return "";
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Constraint_3075(Constraint it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private ValueSpecification specification_Constraint_3075(Constraint it) {
+ // Constraint specification init
+ LiteralString value = UMLFactory.eINSTANCE.createLiteralString();
+ value.setValue("");
+ return value;
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Property_1(Property it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Operation_5(Operation it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Reception_6(Reception it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Property_3079(Property it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Substitution_4012(Substitution it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Manifestation_4014(Manifestation it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_ComponentRealization_4007(ComponentRealization it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Abstraction_4013(Abstraction it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Dependency_4010(Dependency it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Dependency_4017(Dependency it) {
+ return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents());
+ }
+
+ /**
+ * @generated
+ */
+ private String name_Connector_4019(Connector 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.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLEditPartProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLEditPartProvider.java
index ee5fd73a927..ba49323c238 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLEditPartProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLEditPartProvider.java
@@ -25,6 +25,8 @@ public class UMLEditPartProvider extends DefaultEditPartProvider {
* @generated
*/
public UMLEditPartProvider() {
- super(new UMLEditPartFactory(), UMLVisualIDRegistry.TYPED_INSTANCE, ComponentDiagramEditPart.MODEL_ID);
+ super(new UMLEditPartFactory(),
+ UMLVisualIDRegistry.TYPED_INSTANCE,
+ ComponentDiagramEditPart.MODEL_ID);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLElementTypes.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLElementTypes.java
index f16f151ac85..30e0574d8c4 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLElementTypes.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLElementTypes.java
@@ -312,40 +312,107 @@ public class UMLElementTypes {
Object type = hint.getAdapter(IElementType.class);
if (elements == null) {
elements = new IdentityHashMap<IElementType, ENamedElement>();
+
elements.put(Package_1000, UMLPackage.eINSTANCE.getPackage());
+
+
elements.put(Dependency_3203, UMLPackage.eINSTANCE.getDependency());
+
+
elements.put(Component_2002, UMLPackage.eINSTANCE.getComponent());
+
+
elements.put(Model_3202, UMLPackage.eINSTANCE.getModel());
+
+
elements.put(Package_3200, UMLPackage.eINSTANCE.getPackage());
+
+
elements.put(Interface_3205, UMLPackage.eINSTANCE.getInterface());
+
+
elements.put(Comment_3201, UMLPackage.eINSTANCE.getComment());
+
+
elements.put(Constraint_3199, UMLPackage.eINSTANCE.getConstraint());
+
+
elements.put(NamedElement_3204, UMLPackage.eINSTANCE.getNamedElement());
+
+
elements.put(Interface_2003, UMLPackage.eINSTANCE.getInterface());
+
+
elements.put(Port_3069, UMLPackage.eINSTANCE.getPort());
+
+
elements.put(Model_3077, UMLPackage.eINSTANCE.getModel());
+
+
elements.put(Package_3076, UMLPackage.eINSTANCE.getPackage());
+
+
elements.put(Interface_3078, UMLPackage.eINSTANCE.getInterface());
+
+
elements.put(Component_3070, UMLPackage.eINSTANCE.getComponent());
+
+
elements.put(Component_3071, UMLPackage.eINSTANCE.getComponent());
+
+
elements.put(Comment_3074, UMLPackage.eINSTANCE.getComment());
+
+
elements.put(Constraint_3075, UMLPackage.eINSTANCE.getConstraint());
+
+
elements.put(Property_1, UMLPackage.eINSTANCE.getProperty());
+
+
elements.put(Operation_5, UMLPackage.eINSTANCE.getOperation());
+
+
elements.put(Reception_6, UMLPackage.eINSTANCE.getReception());
+
+
elements.put(Interface_3072, UMLPackage.eINSTANCE.getInterface());
+
+
elements.put(Property_3079, UMLPackage.eINSTANCE.getProperty());
+
+
elements.put(Usage_4001, UMLPackage.eINSTANCE.getUsage());
+
+
elements.put(InterfaceRealization_4006, UMLPackage.eINSTANCE.getInterfaceRealization());
+
+
elements.put(Generalization_4003, UMLPackage.eINSTANCE.getGeneralization());
+
+
elements.put(Substitution_4012, UMLPackage.eINSTANCE.getSubstitution());
+
+
elements.put(Manifestation_4014, UMLPackage.eINSTANCE.getManifestation());
+
+
elements.put(ComponentRealization_4007, UMLPackage.eINSTANCE.getComponentRealization());
+
+
elements.put(Abstraction_4013, UMLPackage.eINSTANCE.getAbstraction());
+
elements.put(CommentAnnotatedElement_4015, UMLPackage.eINSTANCE.getComment_AnnotatedElement());
+
elements.put(ConstraintConstrainedElement_4009, UMLPackage.eINSTANCE.getConstraint_ConstrainedElement());
+
+
elements.put(Dependency_4010, UMLPackage.eINSTANCE.getDependency());
+
+
elements.put(Dependency_4017, UMLPackage.eINSTANCE.getDependency());
+
+
elements.put(Connector_4019, UMLPackage.eINSTANCE.getConnector());
}
return elements.get(type);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLMarkerNavigationProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLMarkerNavigationProvider.java
index 926dfdf1810..b8c11564040 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLMarkerNavigationProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLMarkerNavigationProvider.java
@@ -45,7 +45,8 @@ public class UMLMarkerNavigationProvider extends AbstractModelMarkerNavigationPr
if (elementId == null || !(getEditor() instanceof DiagramEditor)) {
return;
}
- DiagramEditor editor = (DiagramEditor) getEditor();
+ DiagramEditor editor =
+ (DiagramEditor) getEditor();
Map<?, ?> editPartRegistry = editor.getDiagramGraphicalViewer().getEditPartRegistry();
EObject targetView = editor.getDiagram().eResource().getEObject(elementId);
if (targetView == null) {
@@ -53,7 +54,8 @@ public class UMLMarkerNavigationProvider extends AbstractModelMarkerNavigationPr
}
EditPart targetEditPart = (EditPart) editPartRegistry.get(targetView);
if (targetEditPart != null) {
- UMLDiagramEditorUtil.selectElementsInDiagram(editor, Arrays.asList(new EditPart[] { targetEditPart }));
+ UMLDiagramEditorUtil.selectElementsInDiagram(
+ editor, Arrays.asList(new EditPart[] { targetEditPart }));
}
}
@@ -81,7 +83,8 @@ public class UMLMarkerNavigationProvider extends AbstractModelMarkerNavigationPr
int markerSeverity = IMarker.SEVERITY_INFO;
if (statusSeverity == IStatus.WARNING) {
markerSeverity = IMarker.SEVERITY_WARNING;
- } else if (statusSeverity == IStatus.ERROR || statusSeverity == IStatus.CANCEL) {
+ } else if (statusSeverity == IStatus.ERROR ||
+ statusSeverity == IStatus.CANCEL) {
markerSeverity = IMarker.SEVERITY_ERROR;
}
marker.setAttribute(IMarker.SEVERITY, markerSeverity);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLParserProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLParserProvider.java
index f1d89feb033..286a9b95552 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLParserProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLParserProvider.java
@@ -83,7 +83,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getDependencyName_5008Parser() {
if (dependencyName_5008Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
dependencyName_5008Parser = parser;
}
@@ -100,7 +102,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getComponentName_5004Parser() {
if (componentName_5004Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
componentName_5004Parser = parser;
}
@@ -117,7 +121,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getModelName_5262Parser() {
if (modelName_5262Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
modelName_5262Parser = parser;
}
@@ -134,7 +140,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getPackageName_5254Parser() {
if (packageName_5254Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
packageName_5254Parser = parser;
}
@@ -151,7 +159,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getInterfaceName_5266Parser() {
if (interfaceName_5266Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
interfaceName_5266Parser = parser;
}
@@ -183,7 +193,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getConstraintName_5252Parser() {
if (constraintName_5252Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
constraintName_5252Parser = parser;
}
@@ -215,7 +227,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getNamedElementName_5265Parser() {
if (namedElementName_5265Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
namedElementName_5265Parser = parser;
}
@@ -232,7 +246,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getInterfaceName_5005Parser() {
if (interfaceName_5005Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
interfaceName_5005Parser = parser;
}
@@ -249,7 +265,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getPortName_5006Parser() {
if (portName_5006Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
portName_5006Parser = parser;
}
@@ -281,7 +299,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getModelName_5264Parser() {
if (modelName_5264Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
modelName_5264Parser = parser;
}
@@ -298,7 +318,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getPackageName_5261Parser() {
if (packageName_5261Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
packageName_5261Parser = parser;
}
@@ -315,7 +337,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getInterfaceName_5267Parser() {
if (interfaceName_5267Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
interfaceName_5267Parser = parser;
}
@@ -332,7 +356,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getComponentName_5256Parser() {
if (componentName_5256Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
parser.setViewPattern("{0}"); //$NON-NLS-1$
parser.setEditorPattern("{0}"); //$NON-NLS-1$
@@ -352,7 +378,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getComponentName_5257Parser() {
if (componentName_5257Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
parser.setViewPattern("{0}"); //$NON-NLS-1$
parser.setEditorPattern("{0}"); //$NON-NLS-1$
@@ -387,7 +415,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getConstraintName_5259Parser() {
if (constraintName_5259Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
constraintName_5259Parser = parser;
}
@@ -419,7 +449,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getProperty_1Parser() {
if (property_1Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
property_1Parser = parser;
}
@@ -436,7 +468,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getOperation_5Parser() {
if (operation_5Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
operation_5Parser = parser;
}
@@ -453,7 +487,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getReception_6Parser() {
if (reception_6Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
parser.setViewPattern("\u00ABSignal\u00BB {0}"); //$NON-NLS-1$
parser.setEditorPattern("{0}"); //$NON-NLS-1$
@@ -473,7 +509,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getInterfaceName_0Parser() {
if (interfaceName_0Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
interfaceName_0Parser = parser;
}
@@ -490,7 +528,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getPropertyName_5268Parser() {
if (propertyName_5268Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
parser.setViewPattern("{0}"); //$NON-NLS-1$
parser.setEditorPattern("{0}"); //$NON-NLS-1$
@@ -525,7 +565,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getSubstitutionName_6006Parser() {
if (substitutionName_6006Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
substitutionName_6006Parser = parser;
}
@@ -557,7 +599,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getManifestationName_6008Parser() {
if (manifestationName_6008Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
manifestationName_6008Parser = parser;
}
@@ -589,7 +633,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getComponentRealizationName_3Parser() {
if (componentRealizationName_3Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
componentRealizationName_3Parser = parser;
}
@@ -621,7 +667,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getAbstractionName_6007Parser() {
if (abstractionName_6007Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
abstractionName_6007Parser = parser;
}
@@ -653,7 +701,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getDependencyName_6009Parser() {
if (dependencyName_6009Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
dependencyName_6009Parser = parser;
}
@@ -700,7 +750,9 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
*/
private IParser getConnectorName_6025Parser() {
if (connectorName_6025Parser == null) {
- EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() };
+ EAttribute[] features = new EAttribute[] {
+ UMLPackage.eINSTANCE.getNamedElement_Name()
+ };
MessageFormatParser parser = new MessageFormatParser(features);
connectorName_6025Parser = parser;
}
@@ -714,44 +766,61 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
switch (visualID) {
case MultiDependencyLabelEditPart.VISUAL_ID:
return getDependencyName_5008Parser();
+
case ComponentNameEditPart.VISUAL_ID:
return getComponentName_5004Parser();
+
case ModelNameEditPart.VISUAL_ID:
return getModelName_5262Parser();
+
case PackageNameEditPart.VISUAL_ID:
return getPackageName_5254Parser();
+
case RectangleInterfaceNameEditPart.VISUAL_ID:
return getInterfaceName_5266Parser();
+
case CommentBodyEditPart.VISUAL_ID:
return getCommentBody_5255Parser();
+
case ConstraintNameEditPart.VISUAL_ID:
return getConstraintName_5252Parser();
case ConstraintSpecificationEditPart.VISUAL_ID:
return getConstraintSpecification_5253Parser();
+
case DefaultNamedElementNameEditPart.VISUAL_ID:
return getNamedElementName_5265Parser();
+
case InterfaceNameEditPart.VISUAL_ID:
return getInterfaceName_5005Parser();
+
case PortNameEditPart.VISUAL_ID:
return getPortName_5006Parser();
case PortAppliedStereotypeEditPart.VISUAL_ID:
return getPortName_5007Parser();
+
case ModelNameEditPartCN.VISUAL_ID:
return getModelName_5264Parser();
+
case PackageNameEditPartCN.VISUAL_ID:
return getPackageName_5261Parser();
+
case RectangleInterfaceNameEditPartCN.VISUAL_ID:
return getInterfaceName_5267Parser();
+
case ComponentNameEditPartCN.VISUAL_ID:
return getComponentName_5256Parser();
+
case ComponentNameEditPartPCN.VISUAL_ID:
return getComponentName_5257Parser();
+
case CommentBodyEditPartPCN.VISUAL_ID:
return getCommentBody_5258Parser();
+
case ConstraintNameEditPartPCN.VISUAL_ID:
return getConstraintName_5259Parser();
case ConstraintSpecificationEditPartPCN.VISUAL_ID:
return getConstraintSpecification_5260Parser();
+
case PropertyForInterfaceEditPart.VISUAL_ID:
return getProperty_1Parser();
case OperationForInterfaceEditPart.VISUAL_ID:
@@ -760,34 +829,50 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
return getReception_6Parser();
case InterfaceNameEditPartPCN.VISUAL_ID:
return getInterfaceName_0Parser();
+
case PropertyPartNameEditPartCN.VISUAL_ID:
return getPropertyName_5268Parser();
+
+
+
case GeneralizationAppliedStereotypeEditPart.VISUAL_ID:
return getGeneralizationIsSubstitutable_2Parser();
+
case SubstitutionNameEditPart.VISUAL_ID:
return getSubstitutionName_6006Parser();
case SubstitutionAppliedStereotypeEditPart.VISUAL_ID:
return getSubstitutionName_6020Parser();
+
case ManifestationNameEditPart.VISUAL_ID:
return getManifestationName_6008Parser();
case ManifestationAppliedStereotypeEditPart.VISUAL_ID:
return getManifestationName_6022Parser();
+
case ComponentRealizationNameEditPart.VISUAL_ID:
return getComponentRealizationName_3Parser();
case ComponentRealizationAppliedStereotypeEditPart.VISUAL_ID:
return getComponentRealizationName_4Parser();
+
case AbstractionNameEditPart.VISUAL_ID:
return getAbstractionName_6007Parser();
case AbstractionAppliedStereotypeEditPart.VISUAL_ID:
return getAbstractionName_6021Parser();
+
+
+
+
case DependencyNameEditPart.VISUAL_ID:
return getDependencyName_6009Parser();
case DependencyAppliedStereotypeEditPart.VISUAL_ID:
return getDependencyName_6023Parser();
+
+
+
case ConnectorAppliedStereotypeEditPart.VISUAL_ID:
return getConnectorName_6024Parser();
case ConnectorNameEditPart.VISUAL_ID:
return getConnectorName_6025Parser();
+
}
return null;
}
@@ -810,7 +895,8 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
if (vid != null) {
return getParser(UMLVisualIDRegistry.getVisualID(vid));
}
- View view = (View) hint.getAdapter(View.class);
+ View view =
+ (View) hint.getAdapter(View.class);
if (view != null) {
return getParser(UMLVisualIDRegistry.getVisualID(view));
}
@@ -823,7 +909,8 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid
@Override
public boolean provides(IOperation operation) {
if (operation instanceof GetParserOperation) {
- IAdaptable hint = ((GetParserOperation) operation).getHint();
+ IAdaptable hint =
+ ((GetParserOperation) operation).getHint();
if (UMLElementTypes.getElement(hint) == null) {
return false;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLValidationDecoratorProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLValidationDecoratorProvider.java
index be75640640d..dce5f500803 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLValidationDecoratorProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLValidationDecoratorProvider.java
@@ -38,7 +38,8 @@ public class UMLValidationDecoratorProvider extends ValidationDecoratorProvider
@Override
public void createDecorators(IDecoratorTarget decoratorTarget) {
EditPart editPart = (EditPart) decoratorTarget.getAdapter(EditPart.class);
- if (editPart instanceof GraphicalEditPart || editPart instanceof AbstractConnectionEditPart) {
+ if (editPart instanceof GraphicalEditPart ||
+ editPart instanceof AbstractConnectionEditPart) {
Object model = editPart.getModel();
if ((model instanceof View)) {
View view = (View) model;
@@ -64,8 +65,10 @@ public class UMLValidationDecoratorProvider extends ValidationDecoratorProvider
if (!(operation instanceof CreateDecoratorsOperation)) {
return false;
}
- IDecoratorTarget decoratorTarget = ((CreateDecoratorsOperation) operation).getDecoratorTarget();
- View view = (View) decoratorTarget.getAdapter(View.class);
+ IDecoratorTarget decoratorTarget =
+ ((CreateDecoratorsOperation) operation).getDecoratorTarget();
+ View view = (View) decoratorTarget.getAdapter(
+ View.class);
return view != null && ComponentDiagramEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view));
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLValidationProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLValidationProvider.java
index aed1a04993c..50f0fff70c5 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLValidationProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLValidationProvider.java
@@ -40,7 +40,6 @@ public class UMLValidationProvider {
public static void runWithConstraints(TransactionalEditingDomain editingDomain, Runnable operation) {
final Runnable op = operation;
Runnable task = new Runnable() {
-
@Override
public void run() {
try {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLViewProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLViewProvider.java
index 04556f5a4a4..36339792feb 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLViewProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/providers/UMLViewProvider.java
@@ -173,20 +173,23 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
*/
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;
+ 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;
}
@@ -292,6 +295,8 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
|| ModelEditPartCN.VISUAL_ID == visualID || PackageEditPartCN.VISUAL_ID == visualID || RectangleInterfaceEditPartCN.VISUAL_ID == visualID || ComponentEditPartCN.VISUAL_ID == visualID || ComponentEditPartPCN.VISUAL_ID == visualID
|| CommentEditPartPCN.VISUAL_ID == visualID || ConstraintEditPartPCN.VISUAL_ID == visualID || PropertyForInterfaceEditPart.VISUAL_ID == visualID || OperationForInterfaceEditPart.VISUAL_ID == visualID
|| ReceptionInInterfaceEditPart.VISUAL_ID == visualID || InterfaceEditPartPCN.VISUAL_ID == visualID || PropertyPartEditPartCN.VISUAL_ID == visualID;
+
+
}
/**
@@ -299,7 +304,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
*/
protected boolean provides(CreateEdgeViewOperation op) {
IElementType elementType = getSemanticElementType(op.getSemanticAdapter());
- // RS: add code for extended types creation
+ //RS: add code for extended types creation
if (elementType instanceof IExtendedHintedElementType) {
IElementType closestNonExtendedType = ElementTypeUtils.getClosestDiagramType(elementType);
if (!UMLElementTypes.isKnownElementType(closestNonExtendedType) || (!(closestNonExtendedType instanceof IHintedType))) {
@@ -310,9 +315,9 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
return false; // foreign element type
}
}
- // if (!org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes.isKnownElementType(elementType) || (!(elementType instanceof org.eclipse.gmf.runtime.emf.type.core.IHintedType))) {
- // return false; // foreign element type
- // }
+ //if (!org.eclipse.papyrus.uml.diagram.component.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()))) {
@@ -456,6 +461,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
stampShortcut(containerView, node);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "DependencyNode");
Node label5008 = createLabel(node, UMLVisualIDRegistry.getType(MultiDependencyLabelEditPart.VISUAL_ID));
label5008.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
@@ -477,6 +483,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
stampShortcut(containerView, node);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Component");
Node label5004 = createLabel(node, UMLVisualIDRegistry.getType(ComponentNameEditPart.VISUAL_ID));
createCompartment(node, UMLVisualIDRegistry.getType(ComponentCompositeCompartmentEditPart.VISUAL_ID), true, true, false, false);
@@ -496,6 +503,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
stampShortcut(containerView, node);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Model");
Node label5262 = createLabel(node, UMLVisualIDRegistry.getType(ModelNameEditPart.VISUAL_ID));
createCompartment(node, UMLVisualIDRegistry.getType(ModelPackageableElementCompartmentEditPart.VISUAL_ID), false, true, false, false);
@@ -515,6 +523,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
stampShortcut(containerView, node);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Package");
Node label5254 = createLabel(node, UMLVisualIDRegistry.getType(PackageNameEditPart.VISUAL_ID));
createCompartment(node, UMLVisualIDRegistry.getType(PackagePackageableElementCompartmentEditPart.VISUAL_ID), false, true, false, false);
@@ -534,6 +543,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
stampShortcut(containerView, node);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Interface");
Node label5266 = createLabel(node, UMLVisualIDRegistry.getType(RectangleInterfaceNameEditPart.VISUAL_ID));
createCompartment(node, UMLVisualIDRegistry.getType(InterfaceAttributeCompartmentEditPart.VISUAL_ID), true, true, true, true);
@@ -554,6 +564,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
stampShortcut(containerView, node);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Comment");
Node label5255 = createLabel(node, UMLVisualIDRegistry.getType(CommentBodyEditPart.VISUAL_ID));
return node;
@@ -571,6 +582,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
stampShortcut(containerView, node);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Constraint");
Node label5252 = createLabel(node, UMLVisualIDRegistry.getType(ConstraintNameEditPart.VISUAL_ID));
Node label5253 = createLabel(node, UMLVisualIDRegistry.getType(ConstraintSpecificationEditPart.VISUAL_ID));
@@ -589,6 +601,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
stampShortcut(containerView, node);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "DefaultNamedElement");
Node label5265 = createLabel(node, UMLVisualIDRegistry.getType(DefaultNamedElementNameEditPart.VISUAL_ID));
return node;
@@ -606,6 +619,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
stampShortcut(containerView, node);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Interface");
Node label5005 = createLabel(node, UMLVisualIDRegistry.getType(InterfaceNameEditPart.VISUAL_ID));
label5005.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
@@ -626,6 +640,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Port");
Node label5006 = createLabel(node, UMLVisualIDRegistry.getType(PortNameEditPart.VISUAL_ID));
label5006.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
@@ -651,6 +666,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Model");
Node label5264 = createLabel(node, UMLVisualIDRegistry.getType(ModelNameEditPartCN.VISUAL_ID));
createCompartment(node, UMLVisualIDRegistry.getType(ModelPackageableElementCompartmentEditPartCN.VISUAL_ID), false, true, false, false);
@@ -669,6 +685,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Package");
Node label5261 = createLabel(node, UMLVisualIDRegistry.getType(PackageNameEditPartCN.VISUAL_ID));
createCompartment(node, UMLVisualIDRegistry.getType(PackagePackageableElementCompartmentEditPartCN.VISUAL_ID), false, true, false, false);
@@ -687,6 +704,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Interface");
Node label5267 = createLabel(node, UMLVisualIDRegistry.getType(RectangleInterfaceNameEditPartCN.VISUAL_ID));
createCompartment(node, UMLVisualIDRegistry.getType(InterfaceAttributeCompartmentEditPartCN.VISUAL_ID), true, true, true, true);
@@ -706,6 +724,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Component");
Node label5256 = createLabel(node, UMLVisualIDRegistry.getType(ComponentNameEditPartCN.VISUAL_ID));
createCompartment(node, UMLVisualIDRegistry.getType(ComponentCompositeCompartmentEditPartCN.VISUAL_ID), true, true, false, false);
@@ -724,6 +743,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Component");
Node label5257 = createLabel(node, UMLVisualIDRegistry.getType(ComponentNameEditPartPCN.VISUAL_ID));
createCompartment(node, UMLVisualIDRegistry.getType(ComponentCompositeCompartmentEditPartPCN.VISUAL_ID), true, true, false, false);
@@ -742,6 +762,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Comment");
Node label5258 = createLabel(node, UMLVisualIDRegistry.getType(CommentBodyEditPartPCN.VISUAL_ID));
return node;
@@ -758,6 +779,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Constraint");
Node label5259 = createLabel(node, UMLVisualIDRegistry.getType(ConstraintNameEditPartPCN.VISUAL_ID));
Node label5260 = createLabel(node, UMLVisualIDRegistry.getType(ConstraintSpecificationEditPartPCN.VISUAL_ID));
@@ -773,6 +795,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setType(UMLVisualIDRegistry.getType(PropertyForInterfaceEditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
+
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Property");
return node;
@@ -787,6 +810,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setType(UMLVisualIDRegistry.getType(OperationForInterfaceEditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
+
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Operation");
return node;
@@ -801,6 +825,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setType(UMLVisualIDRegistry.getType(ReceptionInInterfaceEditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
+
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Reception");
return node;
@@ -817,6 +842,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Interface");
Node label0 = createLabel(node, UMLVisualIDRegistry.getType(InterfaceNameEditPartPCN.VISUAL_ID));
label0.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
@@ -837,6 +863,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
node.setElement(domainElement);
// initializeFromPreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Property");
Node label5268 = createLabel(node, UMLVisualIDRegistry.getType(PropertyPartNameEditPartCN.VISUAL_ID));
return node;
@@ -859,11 +886,13 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
edge.setElement(domainElement);
// initializePreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "Usage");
- // 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);
- // }
+ //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;
}
@@ -884,11 +913,13 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
edge.setElement(domainElement);
// initializePreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "InterfaceRealization");
- // 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);
- // }
+ //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;
}
@@ -909,16 +940,18 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
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);
- // }
+ //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 label2 = createLabel(edge, UMLVisualIDRegistry.getType(GeneralizationAppliedStereotypeEditPart.VISUAL_ID));
label2.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
Location location2 = (Location) label2.getLayoutConstraint();
location2.setX(0);
location2.setY(60);
+
PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "Generalization");
return edge;
}
@@ -940,11 +973,12 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
edge.setElement(domainElement);
// initializePreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "Substitution");
- // 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);
- // }
+ //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 label6006 = createLabel(edge, UMLVisualIDRegistry.getType(SubstitutionNameEditPart.VISUAL_ID));
label6006.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
Location location6006 = (Location) label6006.getLayoutConstraint();
@@ -955,6 +989,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
Location location6020 = (Location) label6020.getLayoutConstraint();
location6020.setX(0);
location6020.setY(30);
+
PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "Substitution");
return edge;
}
@@ -976,11 +1011,12 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
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);
- // }
+ //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 label6008 = createLabel(edge, UMLVisualIDRegistry.getType(ManifestationNameEditPart.VISUAL_ID));
label6008.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
Location location6008 = (Location) label6008.getLayoutConstraint();
@@ -991,6 +1027,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
Location location6022 = (Location) label6022.getLayoutConstraint();
location6022.setX(0);
location6022.setY(30);
+
PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "Manifestation");
return edge;
}
@@ -1012,11 +1049,12 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
edge.setElement(domainElement);
// initializePreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "ComponentRealization");
- // 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);
- // }
+ //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 label3 = createLabel(edge, UMLVisualIDRegistry.getType(ComponentRealizationNameEditPart.VISUAL_ID));
label3.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
Location location3 = (Location) label3.getLayoutConstraint();
@@ -1027,6 +1065,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
Location location4 = (Location) label4.getLayoutConstraint();
location4.setX(0);
location4.setY(30);
+
PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "ComponentRealization");
return edge;
}
@@ -1048,11 +1087,12 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
edge.setElement(domainElement);
// initializePreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "Abstraction");
- // 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);
- // }
+ //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 label6007 = createLabel(edge, UMLVisualIDRegistry.getType(AbstractionNameEditPart.VISUAL_ID));
label6007.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
Location location6007 = (Location) label6007.getLayoutConstraint();
@@ -1063,6 +1103,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
Location location6021 = (Location) label6021.getLayoutConstraint();
location6021.setX(0);
location6021.setY(30);
+
PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "Abstraction");
return edge;
}
@@ -1084,10 +1125,12 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
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);
- // }
+
+ //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;
}
@@ -1108,11 +1151,13 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
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);
- // }
+ //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;
}
@@ -1133,11 +1178,13 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
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);
- // }
+ //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;
}
@@ -1158,11 +1205,12 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
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);
- // }
+ //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 label6009 = createLabel(edge, UMLVisualIDRegistry.getType(DependencyNameEditPart.VISUAL_ID));
label6009.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
Location location6009 = (Location) label6009.getLayoutConstraint();
@@ -1173,6 +1221,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
Location location6023 = (Location) label6023.getLayoutConstraint();
location6023.setX(0);
location6023.setY(60);
+
PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "DependencyLink");
return edge;
}
@@ -1194,11 +1243,13 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
edge.setElement(domainElement);
// initializePreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "Dependency");
- // 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);
- // }
+ //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;
}
@@ -1219,11 +1270,13 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
edge.setElement(null);
// initializePreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "InterfacePortLink");
- // 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);
- // }
+ //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;
}
@@ -1244,11 +1297,12 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
edge.setElement(domainElement);
// initializePreferences
final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+
PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "Connector");
- // 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);
- // }
+ //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 label6024 = createLabel(edge, UMLVisualIDRegistry.getType(ConnectorAppliedStereotypeEditPart.VISUAL_ID));
label6024.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
Location location6024 = (Location) label6024.getLayoutConstraint();
@@ -1259,6 +1313,7 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
Location location6025 = (Location) label6025.getLayoutConstraint();
location6025.setX(0);
location6025.setY(-20);
+
PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(edge, prefStore, "Connector");
return edge;
}
@@ -1289,16 +1344,18 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
* @generated
*/
protected Node createCompartment(View owner, String hint, boolean canCollapse, boolean hasTitle, boolean canSort, boolean canFilter) {
- // SemanticListCompartment rv = NotationFactory.eINSTANCE.createSemanticListCompartment();
- // rv.setShowTitle(showTitle);
- // rv.setCollapsed(isCollapsed);
+ //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);
@@ -1344,13 +1401,16 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
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) {
+ 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());
}
@@ -1372,15 +1432,24 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider {
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());
+
+
+ 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));
+ GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(
+ store.getString(gradientColorConstant));
fillStyle.setGradient(gradientPreferenceConverter.getGradientData());
- fillStyle.setTransparency(gradientPreferenceConverter.getTransparency());
+ fillStyle
+ .setTransparency(gradientPreferenceConverter.getTransparency());
}
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/sheet/UMLPropertySection.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/sheet/UMLPropertySection.java
index 744fc7af57b..ab2b653fc6f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/sheet/UMLPropertySection.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/sheet/UMLPropertySection.java
@@ -26,7 +26,7 @@ public class UMLPropertySection extends DefaultPropertySection implements IPrope
*/
@Override
protected Object transformSelection(Object selected) {
- selected = /* super. */transformSelectionToDomain(selected);
+ selected = /*super.*/transformSelectionToDomain(selected);
return selected;
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/sheet/UMLSheetLabelProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/sheet/UMLSheetLabelProvider.java
index ffccf5d7750..86dd98d3d5b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/sheet/UMLSheetLabelProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/sheet/UMLSheetLabelProvider.java
@@ -75,11 +75,13 @@ public class UMLSheetLabelProvider extends BaseLabelProvider implements ILabelPr
// 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);
+ IElementType etype =
+ UMLElementTypes.getElementType(vid);
if (etype != null) {
return etype;
}
- view = view.eContainer() instanceof View ? (View) view.eContainer() : null;
+ view = view.eContainer() instanceof View ?
+ (View) view.eContainer() : null;
}
return null;
}

Back to the top